react-native-fcm
react-native-fcm copied to clipboard
Default FirebaseApp is not initialized in this process com.mstore. Make sure to call FirebaseApp.initializeApp(Context) first.
RN version: "react-native": "0.35.0" "react": "15.3.2"
When i build and android app and try to run the apk on mobile i get this issue
05-07 07:11:54.733 7587-7624/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules Process: com.mstore, PID: 7587 java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mstore. Make sure to call FirebaseApp.initializeApp(Context) first. at com.google.firebase.FirebaseApp.getInstance(Unknown Source) at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source) at com.evollu.react.fcm.FIRMessagingModule.getFCMToken(FIRMessagingModule.java:73) at java.lang.reflect.Method.invoke(Native Method) at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318) at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) at android.os.Looper.loop(Looper.java:148) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) at java.lang.Thread.run(Thread.java:818)
You're probably missing
apply plugin: 'com.google.gms.google-services'
That fixed it for me.
@AlaaAttyaMohamed is the issue fixed?
@evollu i got same error, "Error: Default FirebaseApp is not initialized in this process com.luthfi. Make sure to call FirebaseApp.initializeApp(Context) first."
my react native apps build was success, no error. but when I try example code in example folder, I got above error.
try update your google play library again? I don't have the issue
I am getting the same error
Error: Default FirebaseApp is not initialized in this process com.luthfi. Make sure to call FirebaseApp.initializeApp(Context) first
@shruti8597 it is most likely your config issue. google this error and check potential fixes
Need to do 2 things:
- Add this to your project level gradle - classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
- Add this to your app level gradle - apply plugin: 'com.google.gms.google-services' Works for me
I already have these 2 things:
Add this to your project level gradle - classpath 'com.google.gms:google-services:4.0.1' // google-services plugin Add this to your app level gradle - apply plugin: 'com.google.gms.google-services' Works for me
but this is not working for me..... Please suggest me how to solve this issue
@snehazanzane I agree with you. None of the solutions seem to be working.
I am using react-native-push-notification
but had the same error. Concerning the build config the RN firebase docs have helped me a lot! Also make sure you use Android Studio since it really helps you with keeping all the dependencies in sync.
dependencies { classpath 'com.android.tools.build:gradle:3.3.1' classpath 'com.google.gms:google-services:4.0.1'
} //This IS Work for me
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cratisspace.wewriteone.ghmc_new/com.cratisspace.wewriteone.ghmc_new.MainActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.cratisspace.wewriteone.ghmc_new. Make sure to call FirebaseApp.initializeApp(Context) first.
am also getting same
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cratisspace.wewriteone.ghmc_new/com.cratisspace.wewriteone.ghmc_new.MainActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.cratisspace.wewriteone.ghmc_new. Make sure to call FirebaseApp.initializeApp(Context) first.
FirebaseApp.initializeApp(Context)
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cratisspace.wewriteone.ghmc_new/com.cratisspace.wewriteone.ghmc_new.MainActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.cratisspace.wewriteone.ghmc_new. Make sure to call FirebaseApp.initializeApp(Context) first.
try out this// dependencies { classpath 'com.android.tools.build:gradle:3.3.1' classpath 'com.google.gms:google-services:4.0.1'
}
Reason and solution:
This is the common error you will get most of the time.
Reason: when you integrate your project with the Firebase it adds the dependencies
implementation 'com.google.firebase:firebase-auth:16.1.0' implementation 'com.google.android.gms:play-services-auth:16.0.1'
and classpath
classpath 'com.google.gms:google-services:4.1.0'
you just need to update them This is how you can update https://youtu.be/5d1g9aqczIE
Need to do 2 things:
- Add this to your project level gradle - classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
- Add this to your app level gradle - apply plugin: 'com.google.gms.google-services' Works for me
- add google-services.json file to app folder downloaded from firebase dashboard
Need to do 2 things:
- Add this to your project level gradle - classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
- Add this to your app level gradle - apply plugin: 'com.google.gms.google-services' Works for me
I will add, just in case it helps anybody, that I had these in place too and was still getting the error. However my version was 4.1.0 instead of 4.0.1, and changing it to 4.0.1 actually solved the issue in my case.
After Adding this apply plugin: 'com.google.gms.google-services' App crashes on android