FirebaseApp with name [DEFAULT] doesn't exist

Please do double check, you added

apply plugin: 'com.google.gms.google-services' 

at the bottom of app's gradle file and then clean and rebuild the project


Not sure, if it is relevant here. But there is another scenario when this crash can happen.


If your app has a service (with different process) and you're creating your own Application class, the service and the foreground app will use the same Application class (not same instance) to initialize. Now when I am using com.google.firebase:firebase-crash dependancy to handle crashes, it creates a background service your.app.packagename:background_crash. For some reason, this was inducing crashes on my app. Specifically, because in my Application class, I was making a call like,

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

I am assuming, the background service when initing with our Application class, somehow Firebase is not initialized. To fix this, I did

if (!FirebaseApp.getApps(this).isEmpty())
        FirebaseDatabase.getInstance().setPersistenceEnabled(true);

I've had similar problem, and for me it was a bug/problem with manifest merger. I've found out that FirebaseInitProvider has not been injected into final manifest file because of tools:node="replace" in my app's manifest file. So, try to remove this xml tag and FirebaseInitProvider will be injected and Firebase can be initialized properly.