Admob在Android应用中导致NullPointerExc

Admob在Android应用中导致NullPointerExc

本文介绍了Admob在Android应用中导致NullPointerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从上周开始,由于一些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'

推荐答案

最好是尝试记录广告响应ID,以基本上查看是否有某种类型的广告使应用崩溃.如果是,则需要在广告管理器中搜索广告并阻止其投放. https://developers.google.com/ad-manager/mobile-ads-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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 20:07