首页 > 解决方案 > 信号 11 (SIGSEGV) Admob Android SDK

问题描述

使用 Admob SDK 19.1.0 时出现以下错误(以下版本也出现此问题):

05-22 05:44:37.375 23965-23965/com.example E/wqqgt: loadUrl() isDestroyed=false mNativeAwContents=546986589440
05-22 05:44:37.375 23965-23965/com.example E/wqqgt: SetExtraHeadersForUrl web_contents = NULL
05-22 05:44:37.375 23965-23965/com.example A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 23965 (om.example)
05-22 05:44:37.437 741-741/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-22 05:44:37.437 741-741/? A/DEBUG: Build fingerprint: 'Letv/LeMax2_WW/le_x2:6.0.1/FGXOSOP5801910121S/letv10120105:user/release-keys'
05-22 05:44:37.437 741-741/? A/DEBUG: Revision: '0'
05-22 05:44:37.437 741-741/? A/DEBUG: ABI: 'arm64'
05-22 05:44:37.437 741-741/? A/DEBUG: pid: 23965, tid: 23965, name: om.example  >>> com.example <<<
05-22 05:44:37.437 741-741/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
05-22 05:44:37.488 20821-21731/? I/NetworkPolicy: real time onreceive...cur_kb:15.37K/s
05-22 05:44:37.488 20821-21731/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:763 com.android.server.net.NetworkPolicyManagerService$4.handleMessage:706 android.os.Handler.dispatchMessage:102 android.os.Looper.loop:148 android.os.HandlerThread.run:61 
05-22 05:44:37.516 741-741/? A/DEBUG:     x0   0000000000000000  x1   c46f58b5d18658e6  x2   c46f58b5d18658e6  x3   c46f58b5d18658e6
05-22 05:44:37.516 741-741/? A/DEBUG:     x4   0000000000000031  x5   00000000ffffffff  x6   0000000000000004  x7   0000007fb21ec010
05-22 05:44:37.516 741-741/? A/DEBUG:     x8   0000000000000042  x9   0000007fb21eb000  x10  0000007fb21ec012  x11  0000000000000000
05-22 05:44:37.516 741-741/? A/DEBUG:     x12  0000007fb21eb000  x13  0000007fb21d6090  x14  0000000000000001  x15  0000007fb21dae39
05-22 05:44:37.516 741-741/? A/DEBUG:     x16  0000007fb21d5ea0  x17  0000007fb66759e4  x18  0000000000000000  x19  0000007ffb5ad9e0
05-22 05:44:37.516 741-741/? A/DEBUG:     x20  0000007ffb5ada10  x21  0000007ffb5ad9f8  x22  0000007fb1cd8180  x23  0000000000000000
05-22 05:44:37.516 741-741/? A/DEBUG:     x24  0000007ffb5adaa0  x25  00002abc00005d9d  x26  00002abc00005d9d  x27  0000000012c97a30
05-22 05:44:37.517 741-741/? A/DEBUG:     x28  0000000070df9c2b  x29  0000007ffb5ad990  x30  0000007f9ad06f9c
05-22 05:44:37.517 741-741/? A/DEBUG:     sp   0000007ffb5ad990  pc   0000007f9acd98b4  pstate 0000000060000000
05-22 05:44:37.531 741-741/? A/DEBUG: backtrace:
05-22 05:44:37.531 741-741/? A/DEBUG:     #00 pc 00000000006068b4  /system/app/webview/webview.apk (offset 0x8b2000)
05-22 05:44:37.531 741-741/? A/DEBUG:     #01 pc 0000000000633f98  /system/app/webview/webview.apk (offset 0x8b2000)
05-22 05:44:37.531 741-741/? A/DEBUG:     #02 pc 0000000000634030  /system/app/webview/webview.apk (offset 0x8b2000)
05-22 05:44:37.531 741-741/? A/DEBUG:     #03 pc 00000000001efa1c  /system/app/webview/oat/arm64/webview.odex (offset 0x18c000)
05-22 05:44:37.986 3779-3784/? E/ANDR-PERF-OPTSHANDLER: perf_lock_rel: updated /sys/class/scsi_host/host0/../../../clkscale_enable with 1
     return value 2
05-22 05:44:38.405 780-850/? E/QCALOG: [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
05-22 05:44:38.406 869-1025/? W/XTCC-5.1.0.8: [CS-RIL-LISTENER] timerCallback fired for ril update registering, re-register
05-22 05:44:38.407 780-850/? E/QCALOG: [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
05-22 05:44:39.344 20821-24962/? W/ActivityManager:   Force finishing activity com.example/.MainActivity
05-22 05:44:39.345 741-741/? A/DEBUG: Tombstone written to: /data/tombstones/tombstone_05
05-22 05:44:39.345 741-741/? E/DEBUG: AM write failed: Broken pipe

我遵循了 admob 文档中的集成指南。

当我使用后退按钮关闭应用程序并再次打开时,就会发生这种情况。应用程序在 10 次后退并打开时出现上述错误。

只是提到我在我的应用程序中使用应用程序类。MainActivity 类的 oncreate 方法如下所示:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    MobileAds.initialize(getApplicationContext(), new OnInitializationCompleteListener() {
        @Override
        public void onInitializationComplete(InitializationStatus initializationStatus) {


        }
    });
    mInterstitialAd = new InterstitialAd(getApplicationContext());
    mInterstitialAd.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
    mInterstitialAd.loadAd(new AdRequest.Builder().build());
    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            // Code to be executed when an ad finishes loading.
            //mInterstitialAd.show();
        }

        @Override
        public void onAdFailedToLoad(int errorCode) {
            // Code to be executed when an ad request fails.
        }

        @Override
        public void onAdOpened() {
            // Code to be executed when the ad is displayed.
        }

        @Override
        public void onAdClicked() {
            // Code to be executed when the user clicks on an ad.
        }

        @Override
        public void onAdLeftApplication() {
            // Code to be executed when the user has left the app.
        }

        @Override
        public void onAdClosed() {
            // Code to be executed when the interstitial ad is closed.
            mInterstitialAd.loadAd(new AdRequest.Builder().build());
        }
    });

我从过去 2 天开始尝试调试,我发现当我尝试加载 AdMob 广告时会发生这种情况。但我没有加载 Admob 插页式广告,它没有收到此错误:

mInterstitialAd.loadAd(new AdRequest.Builder().build());

我本可以假设这与 webview 有关,但我已经在多个设备上测试了相同的行为,并且是相同的。我可以在从 Android 4.4 到 Android 10 的游戏控制台上看到崩溃。

不知道这是否相关,但在分段暴力错误之后我也收到了日志:

05-22 05:44:39.780 22292-23829/? W/GCM: Failed sending response to request: 15
05-22 05:44:40.063 20821-20871/? W/WindowAnimator: Failed to dispatch window animation state change.
    android.os.DeadObjectException
        at android.os.BinderProxy.transactNative(Native Method)
        at android.os.BinderProxy.transact(Binder.java:503)
        at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:558)
        at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:298)
        at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:695)
        at com.android.server.wm.WindowAnimator.access$000(WindowAnimator.java:55)
        at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:126)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:917)
        at android.view.Choreographer.doCallbacks(Choreographer.java:710)
        at android.view.Choreographer.doFrame(Choreographer.java:642)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:905)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.os.HandlerThread.run(HandlerThread.java:61)
        at com.android.server.ServiceThread.run(ServiceThread.java:46)

将硬件加速设置为 false,也无济于事。

android:hardwareAccelerated="false"

标签: javaandroidfirebaseadmobandroid-webview

解决方案


推荐阅读