问题描述
自上周以来,由于一些 admob 错误,我的应用在生产版本中出现了致命错误
Since last week i'm getting a fatal error in my app in production release due some admob bug
Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'com.google.android.gms.ads.internal.overlay.n com.google.android.gms.ads.internal.overlay.AdOverlayInfoParcel.c' on a null object reference
at com.google.android.gms.ads.internal.overlay.k.f(k.java)
at com.google.android.gms.ads.internal.overlay.client.b.a(b.java:1)
at fy.onTransact(fy.java:4)
at android.os.Binder.transact(Binder.java:662)
at com.google.android.gms.internal.ads.zzgu.zzb(zzgu.java:21)
at com.google.android.gms.internal.ads.zzarl.onUserLeaveHint(zzarl.java:54)
at com.google.android.gms.ads.AdActivity.onUserLeaveHint(AdActivity.java:32)
at android.app.Activity.performUserLeaving(Activity.java:7470)
at android.app.Instrumentation.callActivityOnUserLeaving(Instrumentation.java:1476)
at android.app.ActivityThread.performUserLeavingActivity(ActivityThread.java:4034)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4016)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1839)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6864)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
我无法在测试中重现该问题.但正如堆栈所示,这是由于 admob api 响应 android 本机事件的一些内部调用而引起的.
I was not able to reproduce the problem in test. but as the stack shows it is caused due some inner call of the admob api responding to android native events.
我正在使用的版本:
'com.google.gms:google-services:4.3.4'
api "com.google.android.gms:play-services-location:17.1.0"
api 'com.google.android.gms:play-services-ads:19.5.0'
推荐答案
最好是尝试记录 Ad response id 以基本查看是否有某种类型的 Ad 导致 App 崩溃.如果是,您需要在广告管理器中搜索广告并阻止其投放.https://developers.google.com/ad-manager/移动广告 SDK/android/crashlytics
Best is try logging the Ad response id to basically see if there is a certain type of Ad crashing the App. If yes you need to search for Ad in Ad manager and block it from serving. https://developers.google.com/ad-manager/mobile-ads-sdk/android/crashlytics
这篇关于Admob 在 Android 应用程序中导致 NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!