Uri.java line 475 android.net.Uri$StringUri.<init> com.google.android.gms.ads

Viewed 844

I'm getting an error from different device versions (Android 5 - Android 8) since I use ads:

implementation 'com.google.android.gms:play-services-ads:16.0.0'

My error looks like this:

Fatal Exception: java.lang.NullPointerException: uriString
   at android.net.Uri$StringUri.<init>(Uri.java:475)
   at android.net.Uri$StringUri.<init>(Uri.java)
   at android.net.Uri.parse(Uri.java:437)
   at com.google.android.gms.ads.internal.video.a.a(:com.google.android.gms.dynamite_adsdynamite@14366046@14.3.66 (040306-213742215):13)
   at com.google.android.gms.ads.internal.video.gmsg.f.a(:com.google.android.gms.dynamite_adsdynamite@14366046@14.3.66 (040306-213742215):148)
   at com.google.android.gms.ads.internal.webview.j.a(:com.google.android.gms.dynamite_adsdynamite@14366046@14.3.66 (040306-213742215):293)
   at com.google.android.gms.ads.internal.webview.ac.run(Unknown Source:4)
   at android.os.Handler.handleCallback(Handler.java:751)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at com.google.android.gms.ads.internal.util.e.dispatchMessage(:com.google.android.gms.dynamite_adsdynamite@14366046@14.3.66 (040306-213742215):5)
   at android.os.Looper.loop(Looper.java:154)
   at android.app.ActivityThread.main(ActivityThread.java:6776)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

any help is apreciated

2 Answers

There is a bug in version 17.0.0 either you're using

implementation 'com.google.android.gms:play-services-ads:17.0.0'    //or
implementation 'com.google.firebase:firebase-ads:17.0.0'

You can check this thread for more detail.

According to the post from Mobile Ads SDK Team member, issue has been fixed but there is no ETA as of now.


EDIT

I found that above issue is not related to particular admob version. From last week most of the apps with AdMob start crashing, It doesn't matter what admob version you're using. I think there is issue with server side or how they delivered ads(may be getting null in response) and not handled in AdMob SDK level.

So Currently we've

  • Issue with Server side
  • May be some issue in version 17.0.0

Issue already submitted to Mobile Ads SDK team so we've only option to wait for server side fixes or we may get another release after 17.0.0.

I also encountered this issue when I upgraded my ads dependency to the latest version, to find a proper solution keep checking this thread as mentioned by @Aryan in other answer. As a workaround for now you can use the following dependency:

implementation 'com.google.android.gms:play-services-ads:15.0.0'

this will keep the crash from occurring.

Related