nishant pathak nishant pathak - 1 year ago 247
Android Question

Firebase realtime database crash when android application used offline

I am using firebase offline database for my android app, in PreferenceScreen and load dynamic config data.

compile ''

Using it as:


I am using it as per tutorial:

App works fine when it is connected, on offline it is crashing with below stack trace

Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.nishant.starterkit.mock.
Make sure to call FirebaseApp.initializeApp(Context) first.
at Source)
at Source)

Answer Source

Seems like your app has multiple process. Make sure you initialize firebase database only through Context of your application.

    if (!FirebaseApp.getApps(this).isEmpty()) {

You should initialize firebase DB as mentioned above.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download