Я попытался использовать proguard для моего приложения для Android. Я использую в моем приложении, так что я добавил multiDexEnabled = true
в моем build.gradle и, но когда я пытался строить APK, я получил ниже ошибок:Android proguard с помощью Multidex
Error:Execution failed for task
':app:transformClassesWithMultidexlistForRelease'.
> expected one element but was:
</Users/Amir/AndroidStudioProjects/jarchiapp/app/build/intermediates/transforms/proguard/release/jars/3/1f/butterknife-7.0.1.jar,
/Users/Amir/AndroidStudioProjects/jarchiapp/app/build/intermediates/transforms/proguard/release/jars/3/1f/classes.jar,
/Users/Amir/AndroidStudioProjects/jarchiapp/app/build/intermediates/transforms/proguard/release/jars/3/1f/commons-codec-1.10.jar,
/Users/Amir/AndroidStudioProjects/jarchiapp/app/build/intermediates/transforms/proguard/release/jars/3/1f/disklrucache-2.0.2.jar,
/Users/Amir/AndroidStudioProjects/jarchiapp/app/build/intermediates/transforms/proguard/release/jars/3/1f/dualcache-2.2.0.jar, ...>
Вот мой proguard-ruls.pro:
-libraryjars <java.home>/lib/rt.jar(javax/**)
-keepattributes *Annotation*,InnerClasses,EnclosingMethod,Signature
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
-dontwarn rx.**
-dontwarn retrofit.**
-dontwarn okio.**
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
@retrofit.http.* <methods>;
}
-keepnames class com.fasterxml.jackson.** { *; }
-dontwarn com.fasterxml.jackson.databind.**
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
-dontwarn com.marshalchen.ultimaterecyclerview.animators.BaseItemAnimator
-dontwarn com.google.appengine.api.urlfetch.**
-dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry.**
-dontwarn javax.management.**
-dontwarn java.lang.management.**
-dontwarn org.apache.log4j.**
-dontwarn org.apache.commons.logging.**
-dontwarn org.slf4j.**
-dontwarn org.json.**
-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
-keep class javax.** { *; }
-keep class org.** { *; }
-keep class twitter4j.** { *; }
-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 *;
}
В чем проблема и как я могу ее решить?
вы можете проверить [здесь] (http://stackoverflow.com/questions/26925264/android-support-multidex-library-implementation), как добавить поддержка multidex для Android-приложения. –
@ndeokar Я знаю, как добавить его, я не знаю, что не так с proguard – user5510211