Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Admob causes NullPointerException in android apps

Tags:

android

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)

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.

the versions i'm using:

'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'
like image 424
Rafael Lima Avatar asked Nov 01 '20 23:11

Rafael Lima


People also ask

Why is AdMob not showing ads in my app?

Ads won't show if you haven't integrated the Google Mobile Ads SDK correctly. Is your ad implementation code working properly? Test your implementation code to check that ads can show. You can also use ad inspector to test your app's ad serving.

What is null pointer exception in Android?

java.lang.NullPointerException. Thrown when an application attempts to use null in a case where an object is required. These include: Calling the instance method of a null object. Accessing or modifying the field of a null object.


1 Answers

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

like image 177
user3285525 Avatar answered Oct 09 '22 11:10

user3285525