美文网首页
Webview显示错误“未找到类”android.webkit.

Webview显示错误“未找到类”android.webkit.

作者: 扶云九霄 | 来源:发表于2018-04-25 16:29 被阅读53次

    解决方案参考:
    https://stackoverflow.com/questions/47524032/webview-shows-error-didnt-find-class-android-webkit-renderprocessgonedetail

    7.0之后的Android出现问题,自定义WebViewClient可去除此异常

    private class MyWebViewClient extends WebViewClient{
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                // TODO Auto-generated method stub
                super.onPageStarted(view, url, favicon);
            }
    
            @SuppressWarnings("deprecation")
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                final Uri uri = Uri.parse(url);
                return true;
            }
    
            @TargetApi(Build.VERSION_CODES.N)
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
                view.loadUrl(request.getUrl().toString());
                return true;
            }
        }

    相关文章

      网友评论

          本文标题:Webview显示错误“未找到类”android.webkit.

          本文链接:https://www.haomeiwen.com/subject/vgsylftx.html