Home » Android » android – NullPointerException on FirebaseMessagingService.zzo(Unknown Source)

android – NullPointerException on FirebaseMessagingService.zzo(Unknown Source)

Posted by: admin May 14, 2020 Leave a comment

Questions:

Does anyone knows about this crash?

Fatal Exception: java.lang.NullPointerException
       at com.google.firebase.messaging.FirebaseMessagingService.zzo(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)

It doesn’t happen that much, about 0.1% of sessions.

Reported environments: GI-I9500_TMMARS / Android 4.1.1.

How to&Answers:

This problem is discussed as an issue for the Quick Start project. Comments there from the Firebase support team indicate the problem is fixed in SDK version 9.4.0. Are you building with that version?

Answer:

In my case i use wrong key to get value

Map data = remoteMessage.getData();
String name;
name = data.get("naem").toString());
//while correct key is name not naem

Answer:

In order to fix this error you should update firebase in your Gradle file and add the 2nd line:

compile 'com.google.firebase:firebase-messaging:10.0.1' 
compile 'com.google.firebase:firebase-core:10.0.1' // also need to add this line.

Getting a “Could not find” error? Make sure you have
the latest Google Repository in the Android SDK manager

Don’t forget to update the Gradle file in the root folder of your project as well otherwise you won’t be able to get the version 10.0.1:

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

source:

https://github.com/firebase/quickstart-android/issues/185
https://firebase.google.com/docs/android/setup