gpt4 book ai didi

android - 添加 firebase_messaging 后 Flutter 应用程序在启动时崩溃

转载 作者:行者123 更新时间:2023-11-29 18:25:46 26 4
gpt4 key购买 nike

我正在开发一个 flutter 应用程序。我使用 Firestore Clound、Firebase 身份验证等。一切正常,直到我将 firebase_messaging 添加到 pubspec.yaml。该应用程序构建但在启动时崩溃。

错误代码如下:

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
at com.google.android.gms.internal.measurement.zzca.<clinit>(Unknown Source)
at com.google.android.gms.internal.measurement.zzcm.zzr(Unknown Source)
at com.google.android.gms.measurement.internal.zzfj.<init>(Unknown Source)
at com.google.android.gms.measurement.internal.zzfj.zza(Unknown Source)
at com.google.android.gms.measurement.internal.zzfj.zza(Unknown Source)
at com.google.android.gms.measurement.AppMeasurement.zza(Unknown Source)
at com.google.firebase.analytics.connector.AnalyticsConnectorImpl.getInstance(Unknown Source)
at com.google.firebase.analytics.connector.internal.zzb.create(Unknown Source)
at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:firebase-common@@19.0.0:66)
at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(com.google.firebase:firebase-common@@19.0.0)
at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-common@@19.0.0:55)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:firebase-common@@19.0.0:155)
at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common@@19.0.0:553)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:300)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:264)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.0.0:249)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.0.0:51)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1761)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1736)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.0.0:45)
at android.app.ActivityThread.installProvider(ActivityThread.java:6093)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5572)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5511)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1611)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:165)
at android.app.ActivityThread.main(ActivityThread.java:6375)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.util.ArrayMap" on path: DexPathList[[zip file "/data/app/com.example.sports_team_management-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.sports_team_management-1/lib/arm64, /data/app/com.example.sports_team_management-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:74)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 31 more

这是我的 pubspec.yaml

dependencies:
flutter:
sdk: flutter
firebase_messaging: ^6.0.1
firebase_core: ^0.4.0+9
firebase_analytics: ^5.0.2
cloud_firestore: ^0.12.9+5
firebase_auth: ^0.14.0+5
provider: ^3.1.0
flutter_redux: ^0.5.3
redux: ^3.0.0
intl: ^0.16.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
datetime_picker_formfield: ^1.0.0-pre.5
built_value: ^6.6.0
built_collection: ^4.2.2

我发现了一个类似的问题,但解决方案是更改谷歌服务的版本,我之前已经这样做过。请帮助我,我在这里失去了理智

最佳答案

您需要按照 docs 中的说明将您的项目迁移到 Android X。 .

或者降级android文件夹下的插件版本。

如果这没有帮助,请尝试删除 android 文件夹并运行 flutter create . 命令

关于android - 添加 firebase_messaging 后 Flutter 应用程序在启动时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59117202/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com