Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase NullPointerException in Play Services 9.2.1

I updated Google Play Services in my app from 8.4.0 to 9.2.1 and started seeing the following crash coming in multiple times per day:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes()' on a null object reference
       at android.util.Base64.decode(Base64.java:118)
       at com.google.firebase.iid.zzg.zzkl(Unknown Source)
       at com.google.firebase.iid.zzg.zzh(Unknown Source)
       at com.google.firebase.iid.zzd.zzb(Unknown Source)
       at com.google.firebase.iid.zzd.zzcxa(Unknown Source)
       at com.google.firebase.iid.zzd.zzbmu(Unknown Source)
       at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
       at com.google.firebase.iid.FirebaseInstanceId.zzcww(Unknown Source)
       at com.google.firebase.iid.FirebaseInstanceIdService.zzaa(Unknown Source)
       at com.google.firebase.iid.FirebaseInstanceIdService.zzm(Unknown Source)
       at com.google.firebase.iid.zzb$2.run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

I am not explicitly including Firebase nor have I migrated from GCM yet, but I do have google services in my app. I think Firebase coming in through a dependency of my other play-services integrations or the google-services plugin. Here's a snippet of my build.gradle file:

compile 'com.google.android.gms:play-services-analytics:9.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.2.1'
compile 'com.google.android.gms:play-services-places:9.2.1'
compile 'com.google.android.gms:play-services-gcm:9.2.1'

This crash seems very similar to this one but it's coming from getInstance() rather than getToken() so I'm wondering if anyone knows if I'm missing an integration or something like that? I'm hoping that the only answer isn't to wait for google to fix.

UPDATE: I added Firebase to my app through the dashboard, then generated a new google-services.json file, repackaged my app and released a patch. This did not seem to fix the problem, as I am still seeing occurrences in Crashlytics in the new version.

UPDATE 2: I still haven't found a solution, but I've noticed that these crashes are tapering off in Crashlytics. I had 40 the first day, 30 the second day, 10 the third day, and now down to ~4. This leads me to believe that this bug only affects new users or updating users, of which there were a lot initially as my users' apps upgraded to the new version. I still think this is a bug on Google's end and hope they will fix, but at least it's not as widespread as I initially thought.

like image 500
yuval Avatar asked Jul 15 '16 22:07

yuval


1 Answers

As described in my updates, after a few days I saw fewer and fewer of these errors, until now a few weeks later I'm not seeing them at all anymore. So I guess the answer is that this intermittently affects users that are updating their apps, and eventually dies down on its own. Most likely no action is needed on the developer's part.

like image 116
yuval Avatar answered Nov 12 '22 05:11

yuval