Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fcm support Default FirebaseApp is not initialized in this process #285

Closed
AugustoAleGon opened this issue Jan 30, 2019 · 19 comments
Assignees

Comments

@AugustoAleGon
Copy link

I got the following error after trying a migration:

Default FirebaseApp is not initialized in this process bundleID. Make sure to call FirebaseApp.initializeApp(Context) first.

yogevbd added a commit that referenced this issue Jan 30, 2019
@yogevbd
Copy link
Collaborator

yogevbd commented Jan 30, 2019

Published new version with this fix: react-native-notifications@1.2.2.
Can you please confirm this solves the issue?

@AugustoAleGon
Copy link
Author

@yogevbd let me try it today...

@AugustoAleGon
Copy link
Author

@yogevbd . One quick question. I already have my configuration for the previous version of the GCM on Android. I just changing add to the build.gradle this:

    implementation 'com.google.firebase:firebase-messaging:17.3.0'

And also add the file google.services.json to the folder app.

@AugustoAleGon
Copy link
Author

I got the same error. @yogevbd

@AugustoAleGon
Copy link
Author

I could solve the problem. But after sending a test message. I didn't receive nothing.

@AugustoAleGon
Copy link
Author

Sorry to bother you @yogevbd . But after testing the version 1.2.1 it works. Version 1.2.2 didn't work for me.

@AugustoAleGon
Copy link
Author

But it works partially. If I am sending a message from the server. I received just the Title and not the notification text. Please fix this.

@ramonrovirosa
Copy link

ramonrovirosa commented Jan 31, 2019

@AugustoAleGon, I was initially having this issue but then I was able to fix it when I got my firebase configuration correct. Here is my configuration I used

In my root project-level build.gradle I added classpath 'com.google.gms:google-services:3.2.1'

buildscript {
    dependencies {
        ...
        // Add this line
        classpath 'com.google.gms:google-services:3.2.1'
    }
}

In my app-level app/build.gradle I added in dependencies an implementation for firebase & applied the gms service at the bottom of my file

dependencies {
    ...
    // Add this line
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation project(':reactnativenotifications')
    ...
}

...
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'

@AugustoAleGon
Copy link
Author

@ramonrovirosa Thanks appreciate it. That was what I did. I had other problem with another library but that was the way I solved. Have tested sending a message from firebase messaging? I received the title but not the body of the message. Do you have the same problem?

@ramonrovirosa
Copy link

I was able to send a successful test message with a title/body using the Firebase Message Composer https://console.firebase.google.com/project/_/notification.

@AugustoAleGon
Copy link
Author

@ramonrovirosa you save my day. For some reason the last version wasn't working, but your configuration works!

@AugustoAleGon
Copy link
Author

AugustoAleGon commented Feb 2, 2019

@yogevbd I got a weird behaviour. After 5 - 10mins push notifications stop working. I am using also react-native-navigation.

@ilariowiz
Copy link

ilariowiz commented Mar 5, 2019

You should reopen this issue, with the version 1.2.52 this bug is still here

@bradser
Copy link

bradser commented Mar 13, 2019

I was able to resolve by adding the below line to my dependencies, instead of the 'firebase-core' reference, as that caused some Gradle versioning issues for me:

implementation "com.google.firebase:firebase-messaging:17.3.0"

This is the same version of firebase-messaging that's in the project itself.

@roysG
Copy link

roysG commented Apr 19, 2019

Still happens in the last version, any updates?

@tbrennanupgrade
Copy link

I succeeded using https://github.com/Benjamin-Dobell/react-native-notifications/tree/android-overhaul, referenced in #300. I had to follow all the steps, including registering the app with FCM.

@ebaynaud
Copy link

ebaynaud commented May 7, 2019

Thanks for all the advices. I can summarize what I did to fix this error using wix/react-native-notifications v1.5.0 (latest version today).

This project migrated from GCM to Firebase and you need to perform these steps:

  • Setup Firebase following the 4 steps of Option 1.
  • You will get a file called google-services.json to add to your android/app folder => android/app/google-services.json.
  • In step 4, you added implementation 'com.google.firebase:firebase-core:16.0.8', replace it with implementation "com.google.firebase:firebase-messaging:17.3.0" instead.

Your setup should looks now like:

package.json

...
  "dependencies": {
...
    "react-native-notifications": "^1.5.0",
...

build.gradle

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

app/build.gradle

...
dependencies {
    ...
    implementation "com.google.firebase:firebase-messaging:17.3.0"
    ...
}
...
apply plugin: 'com.google.gms.google-services'

That should definitely be documented but no time for a PR now.

@canozgen9
Copy link

Using google-services version 4.3.3 fixed the problem for me.

build.gradle (project level)

buildscript {
  dependencies {
     classpath("com.google.gms:google-services:4.3.3")
  }
}

react-native version: 0.62.18
react-native-notifications version: 3.2.2

@williamdes
Copy link

I am using com.google.gms:google-services:4.3.15 and com.google.gms:google-services:4.4.2 was causing this error.
See: firebase/firebase-android-sdk#4693 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants