Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using react-native-push-notification, App crashes when receiving new FCM notification

I was trying to add push notification on react-native app, so I used react-native-push-notification. The library configuration went well, but when receiving notification the APP crashes immediately saying "FirebaseApp is not initialized".

Crash report AndroidRuntime: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this com.myapp. Make sure to call FirebaseApp.initializeApp(Context) first.

How do I initialize the FirebaseApp or fix this problem? Any help will be greatly appreciated.

For more information there is an opened Github issue https://github.com/zo0r/react-native-push-notification/issues/852

like image 383
sami Avatar asked Aug 31 '18 09:08

sami


1 Answers

OK! it works now.

build.gradle

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

app/build.gradle

// At the very bottom of the file
apply plugin: 'com.google.gms.google-services'

Credit https://github.com/zo0r/react-native-push-notification/issues/852#issuecomment-417641675

like image 186
sami Avatar answered Nov 10 '22 18:11

sami