-3
我無法嘗試生成簽名的APK。Android - 使用Proguard創建簽名APK
我proguard-rules.pro
文件:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
# ================ Google Play Services ================
-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;
}
# ======================================================
# ============ Corrige erros de compilação =============
-dontwarn android.support.**
-keeppackagenames org.jsoup.nodes
-dontwarn okio.**
# ======================================================
# ==== crashlytics ====
-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep public class * extends java.lang.Exception
# =====================
我的依賴關係:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-ads:9.2.0'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.android.support:design:23.4.0'
compile('com.crashlytics.sdk.android:crashlytics:[email protected]') {
transitive = true;
}
compile 'org.jsoup:jsoup:1.9.2'
compile 'com.github.hotchemi:android-rate:1.0.1'
compile 'com.github.curioustechizen.android-ago:library:1.3.2'
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.amitshekhar.android:android-networking:0.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
}
生成錯誤:
Error:Execution failed for task ':mobile:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
:mobile:transformClassesAndResourcesWithProguardForRelease FAILED
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
不知怎的,你幫我覺得 – Josinaldo
好吧,在我的情況下,我決定把「-dontwarn com.squareup.okhttp。**」(LIB畢加索)文件中的「proguard-rules.pro」 – Josinaldo
你能夠建立一個沒有任何副作用的簽名APK? –