I have recently updated the com.google.gms:google-services:4.4.0 dependency, and after that, it started crashing my app. The cause was listed as ‘Initialize the Firebase.’ However, when I downgraded the version of com.google.gms:google-services, it works fine. Please help me with this issue.
Carsh log
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.myproject.activity. Make sure to call FirebaseApp.initializeApp(Context) first. at com.google.firebase.FirebaseApp.getInstance(FirebaseApp.java:179) at com.google.firebase.messaging.FirebaseMessaging.getInstance(FirebaseMessaging.java:126) at com.myproject.activity.MainActivity.onCreate(MainActivity.java:478)
I am trying to update the dependency, and i have alredy initialized firebase in my project in the Application class like this
FirebaseApp.initializeApp(this);
2
Answers
Update: I was able to resolve the issue by following the suggestion provided by firebase support team. The problem arose after updating the
com.google.gms:google-services
dependency to version 4.4.0, causing my app to crash with the error 'Initialize the Firebase.'Upon further investigation, I found that updating the Android Gradle Plugin version to 8.1.0, as recommended, fixed the problem. I appreciate the assistance and hope this solution helps others facing a similar issue.
Try call Init() at
Application.attachContext
, notApplication.onCreate
?add some log to show the order of calls.