问题
I am aware that according to the changelog (0.12.9+5). It supposedly fixed a crash on android where Transaction
s attempted while offline would result in an app crash. However, even with 0.13.7 (the version I'm using). I'm still running into app crashes. There is no error log in the console (just immediate crash).
I've tried:
- Running my app in debug mode on a physical device (same behavior)
- Attaching error handle callback (not called)
- Lowering my
cloud_firestore
version down to 0.12.11 (the lowest version that supportedwhereIn
in querying; it is something I needed and above 0.12.9+5)
Other possibly relevant information:
- Logcat (I've included things that I can remotely guess to be relevant; I don't know how to read logcat)
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
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:764)
Caused by: java.lang.AssertionError: INTERNAL ASSERTION FAILED: A transaction object cannot be used after its update callback has been invoked.
at com.google.firebase.firestore.util.Assert.fail(com.google.firebase:firebase-firestore@@21.3.0:46)
at com.google.firebase.firestore.util.Assert.hardAssert(com.google.firebase:firebase-firestore@@21.3.0:31)
at com.google.firebase.firestore.core.Transaction.ensureCommitNotCalled(com.google.firebase:firebase-firestore@@21.3.0:246)
at com.google.firebase.firestore.core.Transaction.lookup(com.google.firebase:firebase-firestore@@21.3.0:81)
at com.google.firebase.firestore.Transaction.getAsync(com.google.firebase:firebase-firestore@@21.3.0:191)
at com.google.firebase.firestore.Transaction.get(com.google.firebase:firebase-firestore@@21.3.0:228)
at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$5.doInBackground(CloudFirestorePlugin.java:569)
at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$5.doInBackground(CloudFirestorePlugin.java:564)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
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:764)
2020-06-20 15:20:03.272 10188-10241/com.vnf.lightweight_pos E/CloudFirestorePlugin: java.lang.Exception: DoTransaction failed: UNAVAILABLE: Unable to resolve host firestore.googleapis.com
Caused by: java.lang.AssertionError: INTERNAL ASSERTION FAILED: A transaction object cannot be used after its update callback has been invoked.
Channel is unrecoverably broken and will be disposed!
firebase_auth
: 0.16.1
回答1:
I have found a GitHub issue that describes your exact same problem. There's a pending fix for this matter.
In the meantime, according to this comment the best approach seems to be downgrading to version 0.12.10+2.
来源:https://stackoverflow.com/questions/62487206/firestore-transactions-crashing-when-offline