0

I just refactored my project to use the latest FlutterFire sdk > 0.14.1, and all of a sudden in a project that was working before, I'm getting these logs

[OnlineStateTracker]: Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds
W/Firestore( 4617):
W/Firestore( 4617): This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.

I can verify that my device has a very stable Internet connection.

And after a few hot restarts, the app crashes with these logs

Failed to open database '/data/user/0/in.topbrain.quizzie/databases/firestore.%5BDEFAULT%5D.proto-3b7e0.%28default%29'.
E/SQLiteDatabase( 5755): android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5 SQLITE_BUSY[5]): , while compiling: PRAGMA journal_mode

FATAL EXCEPTION: main
E/AndroidRuntime( 4617): Process: in.topbrain.quizzie, PID: 4617
E/AndroidRuntime( 4617): java.lang.RuntimeException: Internal error in Cloud Firestore (21.4.3)

Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Failed to gain exclusive lock to the Cloud Firestore clients offline persistence. 
This generally means you are using Cloud Firestore 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 Cloud Firestore in your Application class.
 If you are intentionally using Cloud Firestore from multiple processes, you can only enable offline persistence (that is, call setPersistenceEnabled(true)) in one of them.

I can also confirm that my firestore is public and is not locked by firestore rules.

1 Answer 1

1

So turns out, that it was because of the network. I was connected to my repeater instead of my router, although they are technically the same network. This refactored version was not working. All other versions of the app were working which is really peculiar behavior but nevertheless, My app is working fine once I connected to the main router. Maybe my router doesn't allow for traffic on the network when the app is in debugging? Not sure.

It would be great if a network expert could explain this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.