quickstart-android icon indicating copy to clipboard operation
quickstart-android copied to clipboard

NullPointerException in FirebaseMessagingService

Open thedumbtechguy opened this issue 10 years ago • 58 comments

I got this crash today. First day in production. The crash report is from Crashalytics.

Fatal Exception: java.lang.NullPointerException
       at com.google.firebase.messaging.FirebaseMessagingService.zzT(Unknown Source)
       at com.google.firebase.messaging.FirebaseMessagingService.zzn(Unknown Source)
       at com.google.firebase.messaging.FirebaseMessagingService.zzm(Unknown Source)
       at com.google.firebase.iid.zzb$2.run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
       at java.lang.Thread.run(Thread.java:856)

thedumbtechguy avatar May 23 '16 15:05 thedumbtechguy

This may be due to a device having an old version of Google Play services, but that's not a great error regardless. Are you seeing a high volume?

ianbarber avatar May 23 '16 17:05 ianbarber

Just one crash from one user. I'm not closing the app when play services is not available so that could be it.

Thanks. On May 23, 2016 6:11 PM, "Ian Barber" [email protected] wrote:

This may be due to a device having an old version of Google Play services, but that's not a great error regardless. Are you seeing a high volume?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/firebase/quickstart-android/issues/16#issuecomment-221044571

thedumbtechguy avatar May 23 '16 19:05 thedumbtechguy

While checking for Google Play services would be good, I think this case is a result of the device in question not having the correct version of Google Play services. I have notified the team and they are looking into it.

kroikie avatar May 23 '16 23:05 kroikie

I also got this crash report from Crashlytics:

Fatal Exception: java.lang.NullPointerException at com.google.firebase.messaging.FirebaseMessagingService.zzT(Unknown Source) at com.google.firebase.messaging.FirebaseMessagingService.zzn(Unknown Source) at com.google.firebase.messaging.FirebaseMessagingService.zzm(Unknown Source) at com.google.firebase.iid.zzb$2.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856)

Device: GI-I9500_TMMARS OS: 4.1.1 ROOTED: Yes

I'm not checking for Google Play Services.

andytriboletti avatar May 29 '16 22:05 andytriboletti

@kroikie I'm receiving the same error here, and I have not added anything of Firebase on my code. I've updated to com.google.android.gms:play-services:9.0.1 that includes it (https://developers.google.com/android/guides/releases#may_2016_-_v90)

But what happens if I don't wanna use Firebase yet?

sibelius avatar Jun 01 '16 13:06 sibelius

@andytriboletti what version of Google Play Services is the device running?

@sibeliusseraphini Firebase Analytics is added by the google-services plugin which should work without issue, but if you want your app to be Firebase free then you can remove the google-services plugin and manually add the required Strings to your strings.xml file.

kroikie avatar Jun 01 '16 20:06 kroikie

How do I find out what version of Google Play Services lib the device is running? Does Firebase log that? If Firebase needs latest version of play services, why not prompt user directly instead of having developer needing to do it resulting in crash if not implemented?

andytriboletti avatar Jun 02 '16 13:06 andytriboletti

@andytriboletti in many cases the SDK does prompt the user to update when they will likely be able to.

You can check your version by going to Settings > Apps > Google Play Services

samtstern avatar Jun 07 '16 23:06 samtstern

I have the latest version on my phone I think, anyway, it's not crashing on my phone. This is from a crash report that a user is experiencing that I saw via Fabric.

andytriboletti avatar Jun 07 '16 23:06 andytriboletti

@sibelius is this happening on your device or a user's device? If possible, could you provide logs?

samtstern avatar Jun 08 '16 23:06 samtstern

@andytriboletti I have the proguard mapping so I can find out where that NPE is happening, I will report to the FCM team.

samtstern avatar Jun 08 '16 23:06 samtstern

this is the logs, the same as the above, this happened in my device running android 4.4

Fatal Exception: java.lang.NullPointerException
       at com.google.firebase.messaging.FirebaseMessagingService.zzT(Unknown Source)
       at com.google.firebase.messaging.FirebaseMessagingService.zzn(Unknown Source)
       at com.google.firebase.messaging.FirebaseMessagingService.zzm(Unknown Source)
       at com.google.firebase.iid.zzb$2.run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
       at java.lang.Thread.run(Thread.java:856)

sibelius avatar Jun 09 '16 15:06 sibelius

@sibelius @andytriboletti ok I have an update here. The SDK team knows about this issue and has a fix in place (it's a simple null check, of course). I can't guarantee exactly when this fix will be integrated into the publicly released SDK, unfortunately.

As that's all we can do here I am going to close this issue. Thank you everyone for your feedback and help identifying this.

samtstern avatar Jun 09 '16 18:06 samtstern

@samtstern does this affect version 9.0.0?

sensen avatar Jun 23 '16 03:06 sensen

Got this issue to with older Android versions. 4.1 - 4.4. Crash logs stacking.

Miindaugas avatar Aug 12 '16 07:08 Miindaugas

following logs for device (GI-I9500_TMMARS) running android 4.1.1

Fatal Exception: java.lang.NullPointerException

   at com.google.firebase.messaging.FirebaseMessagingService.zzT(Unknown Source)
   at com.google.firebase.messaging.FirebaseMessagingService.zzn(Unknown Source)
   at com.google.firebase.messaging.FirebaseMessagingService.zzm(Unknown Source)
   at com.google.firebase.iid.zzb$2.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
   at java.lang.Thread.run(Thread.java:856)

rishi023 avatar Aug 16 '16 11:08 rishi023

@Miindaugas @rishi023 what version of the Firebase SDK are you using in your app? This should be fixed in the 9.4.0 versions.

samtstern avatar Aug 16 '16 16:08 samtstern

Almost the same here : Firebase (play-services) : 9.2.1

at com.google.firebase.messaging.FirebaseMessagingService.zzav(Unknown Source) at com.google.firebase.messaging.FirebaseMessagingService.zzn(Unknown Source) at com.google.firebase.messaging.FirebaseMessagingService.zzm(Unknown Source) at com.google.firebase.iid.zzb$2.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:841)

FabianBravoA avatar Aug 16 '16 18:08 FabianBravoA

@FabianBravoA this was fixed in 9.4.0, could you try updating your dependencies and reporting back if this error still occurs? Remember to update all com.google.android.gms and com.google.firebase dependencies to the same version.

samtstern avatar Aug 16 '16 18:08 samtstern

@samtstern Will do, thanks for the quick reply!

FabianBravoA avatar Aug 16 '16 18:08 FabianBravoA