简体   繁体   English

构建 apk 版本中的 Flutter Firestore 强制关闭(错误)

[英]Flutter firestore force close (error) in build apk release

I got error at firestore stuff when build apk release, the app force close when access that firestore code.在构建 apk 版本时,我在 firestore 内容中遇到错误,当访问该 firestore 代码时,应用程序会强制关闭。 But its fine when direct running (debug) in AS/VS code.但是在 AS/VS 代码中直接运行(调试)时很好。 Any one can explain this?任何人都可以解释这一点?

java.lang.RuntimeException: Internal error in Firestore (19.0.0).
    at com.google.firebase.firestore.g.j.a(:379)
    at com.google.firebase.firestore.g.g.run(Unknown Source:2)
    at android.os.Handler.handleCallback(Handler.java:794)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:176)
    at android.app.ActivityThread.main(ActivityThread.java:6651)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
Caused by: java.lang.AbstractMethodError: abstract method "b.b.g.w$d b.b.g.w$d.b(int)"
    at b.b.g.r.a(:1319)
    at b.b.e.a.da.C(:5440)
    at b.b.e.a.da.a(:5509)
    at b.b.e.a.da.a(:13)
    at b.b.e.a.da$a.a(:6589)
    at com.google.firebase.firestore.f.y.b(:730)
    at com.google.firebase.firestore.c.h.a(:215)
    at com.google.firebase.firestore.c.va.c(:103)
    at com.google.firebase.firestore.c.va.a(:142)
    at com.google.firebase.firestore.c.t.a(:530)
    at com.google.firebase.firestore.c.q.run(Unknown Source:6)
    at com.google.firebase.firestore.c.na.a(:180)
    at com.google.firebase.firestore.c.t.a(:520)
    at com.google.firebase.firestore.b.P.a(:178)
    at com.google.firebase.firestore.b.m.a(:91)
    at com.google.firebase.firestore.b.z.b(:152)
    at com.google.firebase.firestore.b.v.run(Unknown Source:4)
    at com.google.firebase.firestore.g.j.a(:311)
    at com.google.firebase.firestore.g.f.call(Unknown Source:2)
    at com.google.firebase.firestore.g.j.a(:287)
    at com.google.firebase.firestore.g.e.run(Unknown Source:4)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    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:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at com.google.firebase.firestore.g.j$a.run(:205)
    at java.lang.Thread.run(Thread.java:764)

To fix this error, update android.enableR8=false in gradle.properties.要修复此错误,请更新 gradle.properties 中的android.enableR8=false You need to add this row cause default value true .您需要添加此行原因默认值true

There seems to be an issue with the resource optimization (shrink code and obfuscation) when dealing with the Firestore package as seen from java.lang.AbstractMethodError: abstract method "bbgw$d bbgw$db(int)" which appears to be obfuscated code.java.lang.AbstractMethodError: abstract method "bbgw$d bbgw$db(int)"这似乎是混淆代码中看到的处理 Firestore 包时,似乎存在资源优化问题(收缩代码和混淆) .

The help message from flutter build apk -h states that来自flutter build apk -h的帮助消息指出

--[no-]shrink Whether to enable code shrinking on release mode.When enabling shrinking, you also benefit from obfuscation, which shortens the names of your app's classes and members, and optimization, which applies more aggressive strategies to further reduce the size of your app. --[no-]shrink 是否在发布模式下启用代码收缩。启用收缩时,您还受益于混淆,缩短应用程序的类和成员的名称,以及优化,应用更积极的策略以进一步减小大小你的应用程序。 To learn more, see: https://developer.android.com/studio/build/shrink-code (defaults to on)要了解更多信息,请参阅: https : //developer.android.com/studio/build/shrink-code (默认为开启)

You can use the --no-shrink tag when building the apk such as flutter build apk --release --no-shrink to disable shrink code and obfuscation but note that this results in a larger apk.您可以在构建 apk 时使用--no-shrink标签,例如flutter build apk --release --no-shrink来禁用收缩代码和混淆,但请注意,这会导致 apk 更大。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM