简体   繁体   中英

Including "implementation 'com.google.firebase:firebase-analytics:17.4.4'" causes app to crash at startup every time

Here is the Logcat:

2020-07-29 15:36:26.382 1382-8050/? I/ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=XXX bnds=[586,1002][855,1440]} from uid 10156
2020-07-29 15:36:26.386 878-878/? D/android.hardware.power@1.3-service.pixel-libperfmgr: LAUNCH: 1
2020-07-29 15:36:26.390 1382-1382/? V/SettingsProvider: Notifying for 0: content://settings/secure/reminder_exp_learning_time_elapsed
2020-07-29 15:36:26.415 845-845/? D/Zygote: Forked child process 3895
2020-07-29 15:36:26.416 3895-3895/? I/XXX: Late-enabling -Xcheck:jni
2020-07-29 15:36:26.416 1382-1417/? I/ActivityManager: Start proc 3895:XXX/u0a210 for activity {XXX}
2020-07-29 15:36:26.427 3895-3895/? E/XXX: Unknown bits set in runtime_flags: 0x8000
2020-07-29 15:36:26.594 3895-3895/XXX I/MultiDex: VM with version 2.1.0 has multidex support
2020-07-29 15:36:26.594 3895-3895/XXX I/MultiDex: Installing application
2020-07-29 15:36:26.594 3895-3895/XXX I/MultiDex: VM has multidex support, MultiDex support library is disabled.
    
    --------- beginning of crash
2020-07-29 15:36:26.612 3895-3933/X E/AndroidRuntime: FATAL EXCEPTION: ScionFrontendApi
    Process: X, PID: 3895XX
    java.lang.NoSuchFieldError: No static field PREFER_LOCAL of type Lcom/google/android/gms/dynamite/DynamiteModule$VersionPolicy; in class Lcom/google/android/gms/dynamite/DynamiteModule; or its superclasses (declaration of 'com.google.android.gms.dynamite.DynamiteModule' appears in /data/app/XXX-9lVbsCQwO59OkXDFYFHDjg==/base.apk)
        at com.google.android.gms.internal.measurement.zzag.zza(com.google.android.gms:play-services-measurement-sdk-api@@17.4.4:54)
        at com.google.android.gms.internal.measurement.zzaj.zza(com.google.android.gms:play-services-measurement-sdk-api@@17.4.4:12)
        at com.google.android.gms.internal.measurement.zzag$zzb.run(com.google.android.gms:play-services-measurement-sdk-api@@17.4.4:11)
        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:919)
2020-07-29 15:36:26.614 1382-3941/? I/DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
2020-07-29 15:36:26.615 1382-8050/? W/ActivityTaskManager:   Force finishing activity XXX/XXX

Commenting out this line in the app/build.gradle

//    implementation 'com.google.firebase:firebase-analytics:17.4.4'

causes the problem to go away and the app starts normally.

Does

"AndroidRuntime: FATAL EXCEPTION: ScionFrontendApi"
mean anything to anyone?

How about this: 'java.lang.NoSuchFieldError: No static field PREFER_LOCAL of type Lcom/google/android/gms/dynamite/DynamiteModule$VersionPolicy; in class Lcom/google/android/gms/dynamite/DynamiteModule'?

 Thank you.

Appears to be from FirebaseAnalytics (FlutterFire) and some version conflicts. Only happened on release builds. This comment had the answer.

Locking in the Firebase versions in pubspec.yaml worked for me.

  firebase_core: 1.13.1 
  firebase_messaging: 11.2.11
  firebase_analytics: 9.1.0

Did you follow the steps in adding the firebase-analytics dependency as the docs guide ?

as it look like some missing attributes in an inner module.

edit: Lowering the version of the firebase-analytics dependency to a older version (17.3.0) took care of the error.

Just remove/comment this line in the app/build.gradle will fix the issue

implementation "com.google.firebase:firebase-analytics-ktx"

Looks like dependency issues in the firebase-analytics.

For me adding the following lines to proguard rules seems to have fixed it.

-keep class com.google.android.gms.** { *; }
-keep class com.google.firebase.** { *; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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