Android Proguard配置错误

时间:2013-12-06 09:44:02

标签: android proguard

我正在尝试将proguard配置到我的应用程序中。我的应用程序也包含一些jar文件。 当我尝试创建apk文件时,我收到以下错误:

    [2013-12-06 15:05:01 - Ace_Grid] Unexpected error while performing partial evaluation:
    [2013-12-06 15:05:01 - Ace_Grid]   Class       = [org/apache/http/impl/conn/BasicClientConnectionManager]
    [2013-12-06 15:05:01 - Ace_Grid]   Method      = [getConnection$219f236b(Lorg/apache    /http/conn/routing/HttpRoute;)Lorg/apache/http/conn/ManagedClientConnection;]
    [2013-12-06 15:05:01 - Ace_Grid]Exception = [java.lang.IllegalArgumentException]  (Can't find any super classes of [org/apache/http/impl/conn/HttpPoolEntry] (not even immediate super class [org/apache/http/pool/PoolEntry]))
    [2013-12-06 15:05:01 - Ace_Grid] Error: Can't find any super classes of [org/apache/http/impl/conn/HttpPoolEntry] (not even immediate super class [org/apache/http/pool/PoolEntry])

Proguard的-project.txt

-injars      bin/classes
-injars      libs
-outjars     bin/classes-processed.jar
-libraryjars /F:/Softwares/android-sdk/platforms/android-9/android.jar

-dontwarn org.apache.**
-dontwarn org.joda.**
-dontwarn android.support.**
-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*

-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 class android.support.v4.** { *; }   
   -dontwarn android.support.v4.**
    -keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.content.Context {
  public void *(android.view.View);
   public void *(android.view.MenuItem);
}

-keepclassmembers class * implements android.os.Parcelable {
static android.os.Parcelable$Creator CREATOR;
}

-keepclassmembers class **.R$* {
public static <fields>;
}

-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}

1 个答案:

答案 0 :(得分:0)

我们在Amazon IAP库中遇到了类似的问题。我们通过将优化传递设置为1来解决它:

-optimizationpasses 1

或者其他人甚至建议一般禁用优化:

-dontoptimize

希望它有所帮助。