Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
685 views
in Technique[技术] by (71.8m points)

android - Webview in Oreo not working

I am getting this error while opening a webview in Oreo 8. The device is Google Pixel. Kindly help me with the same. Please let me know if you need any additional information.

Process: com.android.chrome:sandboxed_process0, PID: 16787 android.content.res.Resources$NotFoundException: Array resource 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(Unknown Source: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);
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Remove the preloading of fonts by removing

<meta-data 
    android:name="preloaded_fonts" 
    android:resource="@array/preloaded_fonts" />   

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...