【发布时间】:2018-05-04 06:33:17
【问题描述】:
我在生成签名 APK 时遇到问题。
这里是 proguard-rules.pro 文件
-assumenosideeffects class android.util.Log {
public static int v(...);
public static int d(...);
}
# Required to preserve the Flurry SDK
#-keep class com.flurry.** { *; }
#-dontwarn com.flurry.**
#-keepattributes *Annotation*,EnclosingMethod,Signature
#-keepclasseswithmembers class * {
# public (android.content.Context, android.util.AttributeSet, int);
# }
# Google Play Services library
-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;
}
以及以下行中描述的错误
# Google Play Services library
-keep class * extends java.util.ListResourceBundle {
protected Object[ ][ ] getContents();
}
使用的lib版本是
- minSdkVersion = 19
- targetSdkVersion = 27
- compileSdkVersion = 27
- buildToolsVersion = '27.0.0'
- supportLibraryVersion = '27.0.1'
- gmsVersion = '11.6.0'
- firebaseVersion = '11.6.0'
类路径'com.android.tools.build:gradle:3.0.1'
类路径'com.google.gms:google-services:3.1.0'
我需要帮助,问题是什么,如何解决?
注意:我通过 USB 在我的设备上运行应用程序没有问题,但我无法生成用于发布的 APK。
【问题讨论】:
-
一个数组有方括号,中间没有空格。像这样:
protected Object[][] getContents(); -
@MatPag 谢谢,但是当我删除空格时,它会引发此错误“错误:任务':app:transformClassesAndResourcesWithProguardForDevRelease'的执行失败。>作业失败,请参阅日志了解详细信息”你有什么想法请?
-
这是一个完全不同的错误,您应该发布更新后的堆栈跟踪问题
标签: android android-studio android-proguard