Kitkat kills: Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png

后端 未结 8 1020
半阙折子戏
半阙折子戏 2020-11-30 03:54

I have an app that uses WebViews. I\'ve changed my targetAPI from 18 to 19 and I\'m currently testing on the new 4.4. For some reason I\'m getting this error: Not allo

相关标签:
8条回答
  • 2020-11-30 04:51

    I've found a nice workaround in this link : http://trentmilton.com/android-webview.html

    A summary of the solution is something like:

    WebView webView = new WebView(this); // this is the context
    webView.getSettings().setDomStorageEnabled(true);
    

    Hope that helps

    0 讨论(0)
  • 2020-11-30 04:55

    HERE IS THE SOLUTION: This problem occurs when you try to load a file from library projects. If your app depends on a library where webview and html files reside, then you need include assets from that library project into main application project while compiling. For example, IntelliJ has an option to do this. In the compiler settings "Include assets from dependencies into APK", but make sure that your asset files should have different names than main application has. You don't want library project's index.html to be overridden by main app.

    0 讨论(0)
提交回复
热议问题