'Android: Internal error in Cloud Firestore (24.0.2)

Iam using Firestore 24.0.2, and it was working well, but now i surprised that it is not working, and the app crash when opening MainActivity after Splash Activity.

I tried to remove some dependencies and the problem still exist.

So, After the app run:

First -> Splash Screen shown with some code from Firebase RemoteConfig, and it works well.

Second -> It moves to Main Activity which has Fragments that use Firestore, after less than one second from show Main Activity, the app crash, with java.lang.RuntimeException: Internal error in Cloud Firestore (24.0.2)

I've seen a lot of threads and questions on Stack Overflow, GitHub, and more sites, and no solution worked for me.

Full Crash Code:

  java.lang.RuntimeException: Internal error in Cloud Firestore (24.0.2).
        at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:539)
        at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda3.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:246)
        at android.app.ActivityThread.main(ActivityThread.java:8633)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
     Caused by: java.lang.RuntimeException: android.database.sqlite.SQLiteException: not an error (code 0 SQLITE_OK[0])
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:330)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$ExternalSyntheticLambda0.run(Unknown Source:4)
        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 com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:234)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: android.database.sqlite.SQLiteException: not an error (code 0 SQLITE_OK[0])
        at android.database.sqlite.SQLiteConnection.nativeRegisterLocalizedCollators(Native Method)
        at android.database.sqlite.SQLiteConnection.setLocaleFromConfiguration(SQLiteConnection.java:647)
        at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:387)
        at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
        at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
        at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
        at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
        at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
        at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
        at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:980)
        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:444)
        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:387)
        at com.google.firebase.firestore.local.SQLitePersistence.start(SQLitePersistence.java:138)
        at com.google.firebase.firestore.core.ComponentProvider.initialize(ComponentProvider.java:139)
        at com.google.firebase.firestore.core.FirestoreClient.initialize(FirestoreClient.java:272)
        at com.google.firebase.firestore.core.FirestoreClient.lambda$new$0$com-google-firebase-firestore-core-FirestoreClient(FirestoreClient.java:109)
        at com.google.firebase.firestore.core.FirestoreClient$$ExternalSyntheticLambda17.run(Unknown Source:8)
        at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(AsyncQueue.java:441)
        at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda6.call(Unknown Source:2)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:327)
        at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$ExternalSyntheticLambda0.run(Unknown Source:4) 
        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 com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:234) 
        at java.lang.Thread.run(Thread.java:923) 


Solution 1:[1]

I just had to revert to Firestore 24.0.0 and it stopped.

Solution 2:[2]

In my case, I forgot to put await on every Firebase.initializeApp().

await Firebase.initializeApp(name: 'noPersist', options: options);

await Firebase.initializeApp();
FirebaseDatabase.instance.setPersistenceEnabled(true);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adeyemi Seun
Solution 2 Ameerul