将Firebase更新到最新版本后,我在更新到Firebase 9.6.0后,在发布版本中开始出现以下proguard错误。
它在Firebase 9.4.0上运行良好,但在9.6.0中,我无法构建它。
错误讯息:
Information:Gradle tasks [:app:assembleRelease]
Warning:com.google.firebase.messaging.FirebaseMessaging: can't find referenced method 'void zzsv(java.lang.String)' in program class com.google.firebase.iid.FirebaseInstanceId
Warning:com.google.firebase.messaging.FirebaseMessaging: can't find referenced method 'java.lang.String zzdi(android.content.Context)' in program class com.google.firebase.iid.zzf
Warning:com.google.firebase.messaging.FirebaseMessagingService: can't find referenced method 'android.content.Intent zzcwx()' in program class com.google.firebase.iid.FirebaseInstanceIdInternalReceiver
Warning:com.google.firebase.messaging.FirebaseMessagingService: can't find referenced method 'int zzab(android.content.Intent)' in program class com.google.firebase.iid.zzb
Warning:com.google.firebase.messaging.FirebaseMessagingService: can't find referenced method 'void zzble()' in program class com.google.firebase.messaging.FirebaseMessagingService
Warning:com.google.firebase.messaging.zza: can't find referenced method 'android.content.Intent zzi(android.content.Context,android.content.Intent)' in program class com.google.firebase.iid.FirebaseInstanceIdInternalReceiver
Warning:com.google.firebase.messaging.zzb: can't find referenced method 'void zzd(java.lang.String,java.lang.String,android.os.Bundle)' in program class com.google.android.gms.measurement.AppMeasurement
Warning:com.google.firebase.messaging.zzc: can't find referenced method 'int zzcl(android.os.Parcel)' in program class com.google.android.gms.common.internal.safeparcel.zza
Warning:com.google.firebase.messaging.zzc: can't find referenced method 'int zzcm(android.os.Parcel)' in program class com.google.android.gms.common.internal.safeparcel.zza
Warning:com.google.firebase.messaging.zzc: can't find referenced method 'int zzgm(int)' in program class com.google.android.gms.common.internal.safeparcel.zza
Warning:com.google.firebase.messaging.zzc: can't find referenced method 'int zzcn(android.os.Parcel)' in program class com.google.android.gms.common.internal.safeparcel.zzb
Warning:there were 11 unresolved references to program class members.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
Information:BUILD FAILED
Information:Total time: 17.56 secs
Information:1 error
Information:13 warnings
Information:See complete output in console
我的Proguard规则:
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\parth\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-dontwarn okio.**
-dontwarn com.squareup.picasso.**
#playservices
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
#CardView
# http://stackoverflow.com/questions/29679177/cardview-shadow-not-appearing-in-lollipop-after-obfuscate-with-proguard/29698051
-keep class android.support.v7.widget.RoundRectDrawable { *; }
# Appcompat
-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; }
-keep public class android.support.v7.internal.view.menu.** { *; }
-keep public class * extends android.support.v4.view.ActionProvider {
public <init>(android.content.Context);
}
-keep class com.firebase.** { *; }
-keep class org.apache.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-keepnames class javax.servlet.** { *; }
-keepnames class org.ietf.jgss.** { *; }
-dontwarn org.w3c.dom.** -dontwarn org.joda.time.** -dontwarn org.shaded.apache.** -dontwarn org.ietf.jgss.**
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
# Add this global rule
-keepattributes Signaturev
# This rule will properly ProGuard all the model classes in
# the package com.yourcompany.models. Modify to fit the structure
# of your app.
-keepclassmembers class trycodehub.com.model.** {
*;
}
-keepclassmembers enum io.smooch.core.model.** { *; }
-keep class com.google.gson.** { *; }
-keepclassmembers enum * { *; }
-keepattributes Signature
-keepattributes *Annotation*
-keep class java.awt.** { *; }
我的gradle依赖项文件:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:customtabs:24.2.1'
compile 'com.google.firebase:firebase-auth:9.6.0'
compile 'com.google.android.gms:play-services-auth:9.6.0'
compile 'com.google.firebase:firebase-crash:9.6.0'
compile 'com.google.firebase:firebase-database:9.6.0'
compile 'com.firebaseui:firebase-ui-database:0.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'io.smooch:core:latest.release'
compile 'io.smooch:ui:latest.release'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
我建议回滚到9.4.0直到谷歌解决这个问题。