cordova-plugin-firebase: FirebaseApp is not initalized.
After building a new release to submit to the store I am now getting the following error appear when I call ‘getToken’
Default FirebaseApp is not initialized in this process
processName
Make sure to call FirebaseApp.initializeApp(Contect) first.
This is only happening on android the same build is working on IOS, also this error was not present on the last build I did last year.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (1 by maintainers)
Commits related to this issue
- Merged commit https://github.com/mgpartssource/cordova-plugin-firebase/commit/033f0e67f01fda4b4f2415d451a52220d5d48eb8 (fix for https://github.com/arnesson/cordova-plugin-firebase/issues/142) — committed to rubikcuber/cordova-plugin-firebase by rubikcuber 7 years ago
- Fix #142 — committed to Hobbule/cordova-plugin-firebase by quedicesebas 6 years ago
- Merge pull request #565 from Hobbule/master Fix #142 — committed to arnesson/cordova-plugin-firebase by robertarnesson 6 years ago
- Merge pull request #142 from Armanio/patch-1 docs(readme): fix onMessageReceived code sample — committed to KDPInnovations/cordova-plugin-firebase by dpa99c 5 years ago
I had this issue. I built the generated android project in the platform in android studio then I found the issue and solved this.
Follow this steps.
Inside the platforms folder, android/src/{package name}/MainActivity.java
Import the firebase library,
Inside the oncreate method, below super.oncreate(savedinstancestate),
Add FirebaseApp.initializeApp(this);
Last step,
Inside the platforms folder, android/res/values/string.xml,
Add
<string name="google_app_id" templateMergeStrategy="preserve" translatable="false">***</string>
*** can be found in the googleservice.json file “client”: [ { “client_info”: { “mobilesdk_app_id”: this value
Thank you so much @AyoGitNg. It worked well. I love you. 👍 Hahahaha
3 weeks ago with this error.
I actually got this error to go away. I started a fresh project to check if it was something with the plugin and was not getting an error.
I checked the difference between this and my project and realized I had the google-services.json and GoogleService-Info.plist in the root of the project once I removed these it all worked fine.
Edit: Also I am using phonegap so I have these files commited into the plugin directly.