android - Firestore:脱机时事务崩溃

标签 android dart google-cloud-firestore transactions crash

我知道根据更改日志(0.12.9 + 5)。据推测,它修复了Android设备上的崩溃问题,即离线时尝试Transaction会导致应用程序崩溃。但是,即使使用0.13.7(我正在使用的版本)。我仍然遇到应用崩溃的问题。控制台中没有错误日志(只是立即崩溃)。
我试过了:

  • 在物理设备上以 Debug模式运行我的应用程序(行为相同)
  • 附加错误句柄回调(未调用)
  • 将我的cloud_firestore版本降低到0.12.11(在查询中支持whereIn的最低版本;这是我所需要的,并且高于0.12.9 + 5)

  • 其他可能相关的信息:
  • Logcat(我提供了一些可以远程猜测是相关的内容;我不知道如何阅读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
  • 最佳答案

    我发现一个GitHub issue描述了您完全相同的问题。这个问题有待解决的问题。
    同时,根据this comment,最好的方法似乎是降级到0.12.10 + 2版本。

    关于android - Firestore:脱机时事务崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62487206/

    相关文章:

    dart - 如何从 HttpRequest.postFormData 的 catchError 的 _XMLHttpRequestProgressEvent 获取 HTTP 响应文本?

    dart - 当值更改时,我的 CachedNetworkImage 不会更改

    javascript - Firestore 云功能 |基于时间字段的触发事件等于

    java - 在 android web View 中,html 页面被视为在大屏幕而不是在移动设备中打开

    新 Activity 启动或恢复到上一个​​ Activity 时的 Android FAB 动画

    android - 修复Gradle错误 “Attribute ” xxx“已经在Android Studio中定义”的有效方法?

    angular - 无法使用 angularfire2 访问 Angular 6 应用程序中的多个 Google Firestore DB

    android - 使用正确的上下文

    dart - 在Polymer.dart中访问父上下文

    firebase - 我可以循环浏览 Firestore 事务中的文档吗?