I have a little online help consisting of several HTML linked with each other.
That worked fine in the past but with Android 8 can only show the entry page and as soon as I click any link I get:
10-08 09:04:17.616 22871 22871 E AndroidRuntime: FATAL EXCEPTION: main
10-08 09:04:17.616 22871 22871 E AndroidRuntime: Process: net.sourceforge.uiq3.fx602p, PID: 22871
10-08 09:04:17.616 22871 22871 E AndroidRuntime: android.os.FileUriExposedException: file:///android_asset/Modes.html exposed beyond app through Intent.getData()
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.net.Uri.checkFileUriExposed(Uri.java:2356)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.content.Intent.prepareToLeaveProcess(Intent.java:10511)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.content.Intent.prepareToLeaveProcess(Intent.java:10465)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1616)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:4564)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:4522)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.app.Activity.startActivity(Activity.java:4883)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.app.Activity.startActivity(Activity.java:4851)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.content.ContextWrapper.startActivity(ContextWrapper.java:377)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at aiM.startActivity(SourceFile:22)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at agA.a(SourceFile:34)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(SourceFile:173)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.os.MessageQueue.nativePollOnce(Native Method)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.os.MessageQueue.next(MessageQueue.java:325)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.os.Looper.loop(Looper.java:142)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6944)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
10-08 09:04:17.616 22871 22871 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Of course all pages are displayed inside the app and nothing is "leaked" to the outside. And even if: It's just the online help and wouldn't care less if it was.
Enough of the rant: How to fix this?
UPDATE 1:
The page consisted only of a simple layout and an almost empty activity:
<LinearLayout
android:layout_height='match_parent'
android:layout_width='match_parent'
xmlns:android='http://schemas.android.com/apk/res/android'
>
<WebView
android:id='@+id/Help'
android:layout_height='match_parent'
android:layout_width='match_parent'
></WebView>
</LinearLayout>
@igor_rb suggested to overload shouldOverrideUrlLoading
the WebViewClient
— but I don't actually use a WebViewClient
at the moment.