I'm using Firebase database in my Android app and using it for a long time. Recently I faced one issue like when ever I open my app, it is crashing. All I can see is the below error in firebase crash reporting:
Exception java.lang.RuntimeException: Uncaught exception in Firebase Database runloop (3.0.0). Please report to [REDACTED_EMAIL_ADDRESS] com.google.android.gms.internal.zzdzy.run () android.os.Handler.handleCallback (Handler.java:739) android.os.Handler.dispatchMessage (Handler.java:95) android.os.Looper.loop (Looper.java:145) android.app.ActivityThread.main (ActivityThread.java:7007) java.lang.reflect.Method.invoke (Method.java) java.lang.reflect.Method.invoke (Method.java:372) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1404) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1199)
Caused by java.lang.RuntimeException: android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed (code 11) ################################################################# Error Code : 11 (SQLITE_CORRUPT) Caused By : The database disk image is malformed. (database disk image is malformed (code 11)) ################################################################# com.google.android.gms.internal.zzegv.zze () com.google.android.gms.internal.zzefh.zzg () com.google.android.gms.internal.zzefh.zza () com.google.android.gms.internal.zzedn.zza () com.google.firebase.database.zzs.run () java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:422) java.util.concurrent.FutureTask.run (FutureTask.java:237) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:152) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:265) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587) java.lang.Thread.run (Thread.java:818)
<pre>
Caused by android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed (code 11) ################################################################# Error Code : 11 (SQLITE_CORRUPT) Caused By : The database disk image is malformed. (database disk image is malformed (code 11)) #################################################################
android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow (SQLiteConnection.java)
android.database.sqlite.SQLiteConnection.executeForCursorWindow (SQLiteConnection.java:989)
android.database.sqlite.SQLiteSession.executeForCursorWindow (SQLiteSession.java:836)
android.database.sqlite.SQLiteQuery.fillWindow (SQLiteQuery.java:62)
android.database.sqlite.SQLiteCursor.fillWindow (SQLiteCursor.java:144)
android.database.sqlite.SQLiteCursor.getCount (SQLiteCursor.java:133)
android.database.AbstractCursor.moveToPosition (AbstractCursor.java:197)
android.database.AbstractCursor.moveToNext (AbstractCursor.java:245)
com.google.android.gms.internal.zzeaa.zzb ()
com.google.android.gms.internal.zzeaa.zza ()
com.google.android.gms.internal.zzegv.zzf ()
com.google.android.gms.internal.zzefk.call ()
com.google.android.gms.internal.zzegv.zze ()
com.google.android.gms.internal.zzefh.zzg ()
com.google.android.gms.internal.zzefh.zza ()
com.google.android.gms.internal.zzedn.zza ()
com.google.firebase.database.zzs.run ()
java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:422)
java.util.concurrent.FutureTask.run (FutureTask.java:237)
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:152)
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:265)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:818)
The Database version I'm using are:
implementation 'com.google.firebase:firebase-database:11.8.0' implementation 'com.google.firebase:firebase-storage:11.8.0' implementation 'com.google.firebase:firebase-auth:11.8.0' implementation 'com.google.firebase:firebase-crash:11.8.0' implementation 'com.github.bumptech.glide:glide:3.7.0' implementation 'com.google.firebase:firebase-firestore:11.8.0'
I think the Firebase local SQLite database is corrupted. Can somebody tell me how to fix this? If I upgrade to new version will it work or I'll lose the data since it is corrupted?
I'm not able to find what could be the issue?