2

我正在使用人行横道 webview 在我的应用程序中加载 url,但在 3 或 4 秒后应用程序崩溃并出现以下错误。我尝试了很多来解决这个错误,但任何解决方案都对我不起作用。

    --------- beginning of crash
2021-05-05 13:47:35.210 11615-11821/com.OffZone A/libc: Fatal signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xc654f6c6 in tid 11821 (Chrome_InProcRe), pid 11615 (com.OffZone)
2021-05-05 13:47:35.242 2085-2367/? D/MobileSignalController: onSignalStrengthsChanged: SignalStrength: 99 0 -120 -160 -120 -160 -1 20 -107 -11 62 2147483647 0 2147483647 99 255 2147483647 gsm|lte use_rsrp_and_rssnr_for_lte_level  [-128, -115, -110, -105, -97] [-113, -103, -97, -89]
2021-05-05 13:47:35.242 2085-2367/? D/NetworkController.MobileSignalController(2): 4G level = 3
2021-05-05 13:47:35.245 2085-2085/? D/KeyguardUpdateMonitor: received broadcast android.intent.action.BATTERY_CHANGED
2021-05-05 13:47:35.246 3420-3420/? I/BatteryInfoReceiver: ACTION_BATTERY_CHANGED
2021-05-05 13:47:35.248 8587-8626/? D/PowerCheckerService: onBatteryChanged, mBatteryLevel = 60, status = 2, level = 60, plug = 2, scale = 100
2021-05-05 13:47:35.418 12387-12387/? I/crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
2021-05-05 13:47:35.432 870-870/? I//system/bin/tombstoned: received crash request for pid 11821
2021-05-05 13:47:35.454 12387-12387/? I/crash_dump32: performing dump of process 11615 (target tid = 11821)

2021-05-05 13:47:35.495 12387-12387/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2021-05-05 13:47:35.496 12387-12387/? A/DEBUG: Build fingerprint: 'xiaomi/sakura_india/sakura_india:9/PKQ1.180917.001/V12.0.4.0.PDMMIXM:user/release-keys'
2021-05-05 13:47:35.496 12387-12387/? A/DEBUG: Revision: '0'
2021-05-05 13:47:35.496 12387-12387/? A/DEBUG: ABI: 'arm'
2021-05-05 13:47:35.496 12387-12387/? A/DEBUG: pid: 11615, tid: 11821, name: Chrome_InProcRe  >>> com.OffZone <<<
2021-05-05 13:47:35.496 12387-12387/? A/DEBUG: signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xc654f6c6
2021-05-05 13:47:35.496 12387-12387/? A/DEBUG:     r0  00000000  r1  00004001  r2  00000000  r3  00000001
2021-05-05 13:47:35.496 12387-12387/? A/DEBUG:     r4  f0a353c4  r5  cd2ec7cc  r6  c796ea48  r7  00000000
2021-05-05 13:47:35.496 12387-12387/? A/DEBUG:     r8  c79668a9  r9  e2a60980  r10 cd2ec7e8  r11 cd2ec7f4
2021-05-05 13:47:35.496 12387-12387/? A/DEBUG:     ip  f0a3363c  sp  cd2ec7b0  lr  c654e929  pc  c654f6c6
2021-05-05 13:47:35.514 12387-12387/? A/DEBUG: backtrace:
2021-05-05 13:47:35.514 12387-12387/? A/DEBUG:     #00 pc 00acf6c6  /data/app/com.OffZone-ppwvetNOmqiuXBN5BOwqug==/lib/arm/libxwalkcore.so

我正在 xwalk webview 中加载 url,如下所示。

XWalkView webNews;
private String userAgent;

@Override
    protected void onXWalkReady() {

        XWalkSettings webSettings = webNews.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setLoadWithOverviewMode(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setSupportZoom(true);

        // WebView Tweaks
        webSettings.setAllowFileAccess(true);
        webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
        webSettings.setDomStorageEnabled(true);
        webSettings.setLayoutAlgorithm(XWalkSettings.LayoutAlgorithm.NARROW_COLUMNS);
        webSettings.setSaveFormData(true);
        webSettings.setUseWideViewPort(false);

        userAgent = "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36";
        webNews.setUserAgentString(userAgent);
        webNews.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

        XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);
        XWalkPreferences.setValue(XWalkPreferences.ENABLE_JAVASCRIPT, true);
        XWalkPreferences.setValue(XWalkPreferences.SUPPORT_MULTIPLE_WINDOWS, true);
        XWalkPreferences.setValue(XWalkPreferences.ANIMATABLE_XWALK_VIEW, true);
        XWalkPreferences.setValue(XWalkPreferences.ALLOW_UNIVERSAL_ACCESS_FROM_FILE, true);
        XWalkPreferences.setValue(XWalkPreferences.JAVASCRIPT_CAN_OPEN_WINDOW, true);

        webNews.setUIClient(new XWalkUIClient(webNews) {
            @Override
            public void onPageLoadStarted(XWalkView view, String url) {
                super.onPageLoadStarted(view, url);
            }

            @Override
            public void onPageLoadStopped(XWalkView view, String url, LoadStatus status) {
                super.onPageLoadStopped(view, url, status);
            }
        });

        webNews.setResourceClient(new XWalkResourceClient(webNews) {
            @Override
            public void onLoadStarted(XWalkView view, String url) {
                super.onLoadStarted(view, url);

                if (ContextCompat.checkSelfPermission(GameDetailActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
                    ActivityCompat.requestPermissions(GameDetailActivity.this, new String[]{Manifest.permission.CAMERA}, 50);
                } else {
                    if (!URLUtil.isNetworkUrl(url)) {
                        if (url.startsWith("intent://")) {
                            try {
                                Context context = view.getContext();
                                Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);

                                if (intent != null) {
                                    view.stopLoading();

                                    PackageManager packageManager = context.getPackageManager();
                                    ResolveInfo info = packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
                                    if (info != null) {
                                        context.startActivity(intent);
                                    } else {
                                        String fallbackUrl = intent.getStringExtra("browser_fallback_url");
                                        view.loadUrl(fallbackUrl);
                                    }

                                }
                            } catch (URISyntaxException e) {
                                Log.e("TAG", "Can't resolve intent://", e);
                            }
                        } else if (url.endsWith(".apk")) {
                            CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
                            CustomTabsIntent customTabsIntent = builder.build();
                            customTabsIntent.launchUrl(GameDetailActivity.this, Uri.parse(url));
                        }
                    }
                }
            }

            @Override
            public void onLoadFinished(XWalkView view, String url) {
                super.onLoadFinished(view, url);
            }

            @Override
            public void onDocumentLoadedInFrame(XWalkView view, long frameId) {
                super.onDocumentLoadedInFrame(view, frameId);
            }
        });

        webNews.loadUrl(appUrl);
    }

请任何人知道这个答案然后请给出答案。提前致谢 :) 。

4

0 回答 0