Google Play服务和Firebase的ProGuard问题

时间:2017-04-06 18:27:35

标签: android firebase google-play-services android-proguard

升级Google Play服务及相关库后,我收到Proguard关于firebase消息的警告。

  1. 播放服务:9.4.0 - > 10.2.1
  2. MixPanel:4.9.2 - > 4.9.8
  3. 对讲:3.0.10 - > 3.1.3
  4. 以下是来自com.google.firebase.messaging.*

    的预警警告
    Warning: com.google.firebase.messaging.FirebaseMessagingService: can't find referenced method 'com.google.firebase.iid.zzg zzabT()' in program class com.google.firebase.iid.zzg
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'java.lang.String zzcvH' in program class com.google.android.gms.internal.zzbxz$zza
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'java.lang.String zzcvH' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'java.lang.String zzcvI' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'long zzcvJ' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'java.lang.String zzcvK' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'int zzcvL' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'int zzcvM' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'java.lang.String zzcvN' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'java.lang.String zzcvO' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'java.lang.String zzcvR' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'int zzcvS' in program class com.google.android.gms.internal.zzbxz$zzb
    Warning: com.google.firebase.messaging.zzc: can't find referenced field 'com.google.android.gms.internal.zzbxz$zza[] zzcvT' in program class com.google.android.gms.internal.zzbxz$zzb
    

    我正在使用最新的播放服务。

    intercomLibraryVersion = '3.1.3' // https://github.com/intercom/intercom-android/blob/master/CHANGELOG.md
    mixPanelVersion = '4.9.8' // https://github.com/mixpanel/mixpanel-android/releases
    playServiceVersion = '10.2.1' // https://developers.google.com/android/guides/releases
    
    // Google Play Services
    // https://developers.google.com/android/guides/setup
    // https://firebase.google.com/docs/android/setup
    compile "com.google.android.gms:play-services-base:$rootProject.playServiceVersion"
    compile "com.google.android.gms:play-services-gcm:$rootProject.playServiceVersion"// used by - mixpanel & intercom
    
    // Mixpanel
    //https://github.com/mixpanel/mixpanel-android/releases
    compile "com.mixpanel.android:mixpanel-android:$rootProject.mixPanelVersion"
    
    // Intercom - live chat and analytics
    // https://github.com/intercom/intercom-android
    // https://developers.intercom.com/docs/android-installation
    compile "io.intercom.android:intercom-sdk-base:$rootProject.intercomLibraryVersion"
    compile "io.intercom.android:intercom-sdk-fcm:$rootProject.intercomLibraryVersion"
    

    我唯一可以避免这些警告的方法是添加以下proguard规则。

    -dontwarn com.google.firebase.messaging.**
    

    有人知道这方面的影响吗?或者如何修复此firebase消息问题。

    更新#1 App现在随机崩溃并跟随堆栈跟踪。

    04-06 14:49:28.911 25362-25455/? E/AndroidRuntime: FATAL EXCEPTION: pool-13-thread-1
        Process: com.myapp, PID: 25362
        java.lang.AbstractMethodError: abstract method "void com.google.firebase.iid.b.handleIntent(android.content.Intent)"
        at com.google.firebase.iid.b$1.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)
    

1 个答案:

答案 0 :(得分:23)

当您忘记更新firebase依赖项时,通常会出现此错误。

Firebase引用必须始终与google依赖项的版本相同。

这会遇到错误:

compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'

compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'

这解决了错误:

compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'

compile 'com.google.firebase:firebase-auth:10.2.1' //Updated
compile 'com.google.firebase:firebase-core:10.2.1' //Updated
compile 'com.google.firebase:firebase-database:10.2.1' //Updated

希望它能解决你的问题