我正在开发一个我颤动的应用程序。我使用Firestore Clound,Firebase Authentication等。一切都很好,直到我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
我发现了一个类似的问题,但解决方案是更改Google服务的版本,我之前已经这样做了。 请帮助我,我在这里失去理智
您需要按照文档中的说明将项目迁移到 Android X。
或者降级安卓文件夹中的插件版本。
如果这没有帮助,请尝试删除android
文件夹并运行flutter create .
命令