Skip to content
Advertisement

Firebase firestore problem ‘Make sure to call FirebaseApp.initializeApp(Context) first’

I’m doing a new project in Android Studio. I’d like to make my project in latest version and with Firebase Firestore to keep data.

I know that i need to put apply plugin: 'com.google.gms.google-services' but i don’t find how .. and with lot of research, someone said that it is included in the 'com.android.application'..

I have included my google-services.json in the app document

I also tried to dowgrade gradle version and google.gms version, but unsuccessful

Here are my configuration :

app :

JavaScript

My other build.gradle :

JavaScript

And my MainActivity.java :

JavaScript

Just in order to get data from my databse (which i populated before)

So, when install and execute my application on my computer, i got this error :

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.eating/com.example.eating.MainActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.eating. Make sure to call FirebaseApp.initializeApp(Context) first.

I don’t know how to solve this.

Advertisement

Answer

build.gradle(module:app)

JavaScript

AndroidManifest.xml

JavaScript

MyApplication.java

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement