Our Android app uses Firebase Realtime Database for its use cases.We have gone live with Realtime Database, and are seeing the below crash from SDK.
I would like to confirm that, Android App is a single process application and cannot run in multiple processes. I can also confirm that setPersistanceEnabled is called only once in the application.
Can you throw some light on how we go about this crash?
Caused by com.google.firebase.database.DatabaseException
Failed to gain exclusive lock to Firebase Database's offline persistence. This generally means you are using Firebase Database from multiple processes in your app. Keep in mind that multi-process Android apps execute the code in your Application class in all processes, so you may need to avoid initializing FirebaseDatabase in your Application class. If you are intentionally using Firebase Database from multiple processes, you can only enable offline persistence (i.e. call setPersistenceEnabled(true)) in one of them
Caused by com.google.firebase.database.DatabaseException: Failed to gain exclusive lock to Firebase Database's offline persistence. This generally means you are using Firebase Database from multiple processes in your app. Keep in mind that multi-process Android apps execute the code in your Application class in all processes, so you may need to avoid initializing FirebaseDatabase in your Application class. If you are intentionally using Firebase Database from multiple processes, you can only enable offline persistence (i.e. call setPersistenceEnabled(true)) in one of them.
at com.google.firebase.database.android.SqlPersistenceStorageEngine.openDatabase(SqlPersistenceStorageEngine.java:861)
at com.google.firebase.database.android.SqlPersistenceStorageEngine.<init>(SqlPersistenceStorageEngine.java:216)
at com.google.firebase.database.android.AndroidPlatform.createPersistenceManager(AndroidPlatform.java:164)
at com.google.firebase.database.core.Context.getPersistenceManager(Context.java:158)
at com.google.firebase.database.core.Repo.deferredInitialization(Repo.java:137)
at com.google.firebase.database.core.Repo.access$000(Repo.java:61)
at com.google.firebase.database.core.Repo$1.run(Repo.java:100)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)