Not sure if this is relevant. But there is another scenario when this can happen.
If your application has a service (with a different process) and you create your own Application class, the service and front-end application will use the same application class ( not the same instance ) to initialize. Now when I use the com.google.firebase:firebase-crash dependency to handle failures, the background service your.app.packagename:background_crash . For some reason, this caused crashes in my application. In particular, because in my application class I made a call like
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
I assume that the background service when initializing with our Application class, somehow Firebase does not initialize. To fix this, I did
if (!FirebaseApp.getApps(this).isEmpty()) FirebaseDatabase.getInstance().setPersistenceEnabled(true);
Codevalley Jul 24. '16 at 4:08 2016-07-24 04:08
source share