FirebaseApp not initializing despite FirebaseApp.initializeApp() being called in Application class

I know there's already an accepted answer. However, I ran into the same error message saying: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process (name). Make sure to call FirebaseApp.initializeApp(Context). I tried several solutions found on SO, and double checking everything, until I finally found that the package name defined in the Firebase Console didn't match the package name defined in my manifest file.

Try go to your Firebase Console -> Project settings -> check if package names matches.

Hope it may help some :)


Just as qbix stated, you much use the API calls from whichever version you are going to use. If possible, you should use the newer API because it will definitely be supported much further into the future.

See the docs here:

https://firebase.google.com/docs/database/android/start/

Remove:

Firebase.setAndroidContext(this);
FirebaseApp.initializeApp(this);

And put:

FirebaseDatabase database = FirebaseDatabase.getInstance();

If qbix puts his comment into an answer, you should accept his rather than mine seeing has how he beat me by a few minutes.

Also:

If you are using the old firebase and need help switching, this guide is spot on and will help you with the switch. It's a fairly simple switch.

https://firebase.google.com/support/guides/firebase-android