在Oreo 8中打开Webview时,我遇到了这个错误。设备为Google Pixel。请帮我解决这个问题。如果需要任何其他信息,请告诉我。
进程:com.android.chrome:sandboxed_process0,PID:16787 android.content.res.Resources$NotFoundException:数组资源ID #0x7f030010 at android.content.res.Resources.obtainTypedArray(Resources.java:617) at android.content.res.Resources.preloadFonts(Resources.java:379) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5815) at android.app.ActivityThread.-wrap1(未知来源:0) at android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1661) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.WebViewZygoteInit.main(WebViewZygoteInit.java:121)
WebSettings settings = binding.landingWb.getSettings();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
settings.setSafeBrowsingEnabled(true);
}
//binding.loader.setVisibility(View.GONE);
settings.setJavaScriptEnabled(true);
binding.landingWb.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
binding.landingWb.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url != null) {
if (url.startsWith("whatsapp://")) {
view.getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true;
} else {
view.loadUrl(url);
return true;
}
} else {
binding.loader.setVisibility(View.GONE);
return false;
}
}
@Override
public void onPageFinished(WebView view, String url) {
binding.loader.setVisibility(View.GONE);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.d(TAG, "onReceivedError() called with: view = [" + view + "], errorCode = [" + errorCode + "], description = [" + description + "], failingUrl = [" + failingUrl + "]");
binding.loader.setVisibility(View.GONE);
}
});
binding.landingWb.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
Log.e("CompetitionActivity","Progress: " + newProgress);
}
});
binding.landingWb.loadUrl(url);