在flutter中释放apk安卓程序在启动时崩溃

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在flutter中释放apk安卓程序在启动时崩溃相关的知识,希望对你有一定的参考价值。

我认为我的问题是因为我在我的应用程序中使用的Cloudfirestore。有些设备崩溃而有些没有。(S7 samsung verizon android 8.0崩溃,A5 samsung android 6.0没有崩溃......)。我使用logcat来获取导致崩溃的日志,这是错误:

java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
        at com.google.firebase.firestore.obfuscated.zzgf.zzb(com.google.firebase:firebase-firestore@@17.1.1:377)
        at com.google.firebase.firestore.obfuscated.zzgk.run(com.google.firebase:firebase-firestore@@17.1.1)
        at android.os.Handler.handleCallback(Handler.java:725)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:176)
        at android.app.ActivityThread.main(ActivityThread.java:5302)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.RuntimeException: io.grpc.ManagedChannelProvider$ProviderNotFoundException: No functional channel service provider found. Try adding a dependency on the grpc-okhttp or grpc-netty artifact
        at com.google.firebase.firestore.obfuscated.zzgf.zza(com.google.firebase:firebase-firestore@@17.1.1:288)
        at com.google.firebase.firestore.obfuscated.zzgi.run(com.google.firebase:firebase-firestore@@17.1.1)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at com.google.firebase.firestore.obfuscated.zzgf$zza.run(com.google.firebase:firebase-firestore@@17.1.1:203)
        at java.lang.Thread.run(Thread.java:856)
     Caused by: io.grpc.ManagedChannelProvider$ProviderNotFoundException: No functional channel service provider found. Try adding a dependency on the grpc-okhttp or grpc-netty artifact
        at io.grpc.ManagedChannelProvider.provider(ManagedChannelProvider.java:60)
        at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:70)
        at com.google.firebase.firestore.obfuscated.zzfk.<init>(com.google.firebase:firebase-firestore@@17.1.1:101)
        at com.google.firebase.firestore.obfuscated.zzm.zza(com.google.firebase:firebase-firestore@@17.1.1:1216)
        at com.google.firebase.firestore.obfuscated.zzt.run(com.google.firebase:firebase-firestore@@17.1.1)
        at com.google.firebase.firestore.obfuscated.zzgf.zzc(com.google.firebase:firebase-firestore@@17.1.1:309)
        at com.google.firebase.firestore.obfuscated.zzgj.call(com.google.firebase:firebase-firestore@@17.1.1)
        at com.google.firebase.firestore.obfuscated.zzgf.zza(com.google.firebase:firebase-firestore@@17.1.1:285)
        at com.google.firebase.firestore.obfuscated.zzgi.run(com.google.firebase:firebase-firestore@@17.1.1) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
        at com.google.firebase.firestore.obfuscated.zzgf$zza.run(com.google.firebase:firebase-firestore@@17.1.1:203) 
        at java.lang.Thread.run(Thread.java:856) 

那么如何解决这种错误?

答案

与三星S5等手机有同样的问题。当我试图打开它时,应用程序开始崩溃。这是一个对我有用的修复:

defaultConfig {
    ...
    multiDexEnabled true
    ndk {
        abiFilters 'x86', 'armeabi-v7a'
    }
}

不得不在ndk文件中添加android/app/build.gradle,它就像一个魅力。

我希望这可以帮助别人。

另一答案

如果您在pubspec.yaml中安装了最新的cloud_firestore软件包(0.8.2 + 3),请先检查一下

您可以在<yourapp>/android/build.gradle(当前版本4.2.0)下升级Google服务。但请注意,您可能需要升级其他插件以及其中的最新版本。

以上是关于在flutter中释放apk安卓程序在启动时崩溃的主要内容,如果未能解决你的问题,请参考以下文章

Expo React Native Bare 发布 APK 在启动时立即崩溃

如果我包含某个包,Flutter android 应用程序在启动时崩溃

Flutter Release 应用程序在启动时崩溃:找不到 libflutter.so

Xamarin安卓应用程序在启动时与BroadcastReceiver崩溃但是启动了吗?

在模拟器中安装 Flutter Release apk

为啥我的 Flutter 应用在​​ iOS 上启动时会崩溃?