我在我的应用中使用WebView,而加载内容警告日志来自logcat,如下所示
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.SafeBrowsingResponse" on path: DexPathList[[zip file "/data/app/com.android.chrome-1/base.apk"],nativeLibraryDirectories=[/data/app/com.android.chrome-1/lib/arm, /data/app/com.android.chrome-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
在该应用程序一次又一次崩溃之后
04-25 09:46:49.219 26505-26505/com.abc W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
04-25 09:46:49.219 26505-26505/com.abc W/google-breakpad: Chrome build fingerprint:
04-25 09:46:49.219 26505-26505/com.abc W/google-breakpad: 5.0.7lab
04-25 09:46:49.219 26505-26505/com.abc W/google-breakpad: 58
04-25 09:46:49.219 26505-26505/com.abc W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
04-25 09:46:49.219 26505-26505/com.whence A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xca480db0 in tid 26505 (com.whence)
[ 04-25 09:46:49.219 469: 469 W/ ]
debuggerd: handling request: pid=26505 uid=10314 gid=10314 tid=26505
答案 0 :(得分:2)
该问题的解决方案是:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
view.getSettings().setSafeBrowsingEnabled(false);
}
WebSettings settings = view.getSettings();
settings.setJavaScriptEnabled(true);
让我知道这是否对您不起作用。
答案 1 :(得分:0)
webView.getSettings().setJavaScriptEnabled(true);
尝试添加这些行。有关详细信息https://developer.android.com/reference/android/webkit/WebSettings.html
答案 2 :(得分:-4)
由于这是API27中添加的,请尝试按以下方式设置SDK级别:
min=27
target=27
compile=27