I am creating an Android application and I\'m currently trying to implement user authentication using Firebase. As far as I can tell, my app is connected to my Firebase serv
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
First check up should be the Firebase documentation and the tools from
Android Studio -> Tools -> Firebase -> Cloud Messaging.
Even if you have done that before.
See this, that and that.
Again, even if you already done that before as firebase versions tend to require an up to date configuration JSON.
After much frustration, enabling Internet Permissions fixed this issue for me.
Upgrading classpath 'com.google.gms:google-services:4.1.0'
to classpath 'com.google.gms:google-services:4.2.0'
in the project Gradle worked for me.
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 :)
It is easier to use the Firebase wizard that is included in Android Studio: it adds all the dependencies in the gradle files, creates the firebase project if needed, connects the app with the project, etc.
In Android Studio open menu Tools / Firebase and follow the instructions.
Then FirebaseApp.initializeApp() will return a valid value.