0
我真的不明白我需要做什麼才能讓proguard減小apk的大小。我發佈的應用程序使用的是Google Maps API v2,至今爲止,除了在嘗試生成已簽名的APK時顯示此消息這一事實,它的工作狀況良好。Android:發佈版本由於無法計算散列而失敗?
Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of (app path)\app\build\intermediates\classes-proguard\release\classes.jar
如何解決此問題?
搖籃:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.abcd.efgh"
minSdkVersion 11
targetSdkVersion 23
versionCode 2
versionName "1.1"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:23.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
}
proguard的-project.txt
-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;
}
-keep public class com.google.android.gms.maps.** { *; }
-keep interface com.google.android.gms.maps.** { *; }
-dontwarn com.google.android.gms.**