.NullPointerException in FirebaseMessaging.getInstance()

Viewed 391

I'm trying to integrate FCM in my Android app developed in Android Studio Like Always، before many times have I done this. But I get NullPointerException in FirebaseMessaging.getInstance()

Here's the logcat

  java.lang.RuntimeException: Unable to start activity ComponentInfo{ir.lahni.whlmobile/ir.lahni.whlmobile.Splash}: java.lang.NullPointerException
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2429)
    at android.app.ActivityThread.access$800(ActivityThread.java:151)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1342)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:5333)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.NullPointerException
    at com.google.firebase.messaging.FirebaseMessaging.subscribeToTopic(Unknown Source)

And Here is my implemention library

 implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
implementation 'com.google.firebase:firebase-iid:17.0.3'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'

Update:

Finally I find out solution. You should remove this line from manifest

  tools:node="replace"
0 Answers
Related