RN 0.59.10 使用RN内置webview加载 assert下html 崩溃



  • RN 0.59.10 使用RN内置webview加载 assert下html 崩溃
    错误信息如下:
    android.os.FileUriExposedException: file:///android_asset/tpl.html exposed beyond app through Intent.getData()
    at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
    at android.net.Uri.checkFileUriExposed(Uri.java:2356)
    at android.content.Intent.prepareToLeaveProcess(Intent.java:9784)
    at android.content.Intent.prepareToLeaveProcess(Intent.java:9736)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1611)
    at android.app.Activity.startActivityForResult(Activity.java:4536)
    at android.app.Activity.startActivityForResult(Activity.java:4494)
    at android.app.Activity.startActivity(Activity.java:4855)
    at android.app.Activity.startActivity(Activity.java:4823)
    at android.content.ContextWrapper.startActivity(ContextWrapper.java:376)
    at com.facebook.react.views.webview.ReactWebViewManager$ReactWebViewClient.launchIntent(ReactWebViewManager.java:194)
    at com.facebook.react.views.webview.ReactWebViewManager$ReactWebViewClient.shouldOverrideUrlLoading(ReactWebViewManager.java:155)
    at android.webkit.WebViewClient.shouldOverrideUrlLoading(WebViewClient.java:73)
    at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:73)
    at org.chromium.android_webview.AwContentsClient.shouldIgnoreNavigation(AwContentsClient.java:15)
    at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(AwContentsClientBridge.java:160)
    at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
    at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:9)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:171)
    at android.app.ActivityThread.main(ActivityThread.java:6699)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:246)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
    在升级到 RN 0.59.10 之前功能是没有问题的,看报错信息时因为Android N对访问文件权限收回的原因,但要做适配就要修改RN中的源码,大家有没有更好的解决办法



  • 内置webview没有维护了,用社区版的


Log in to reply