android使用proguard

废话不多说了,直接放上文件:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses 如果没有这句,在有libs的情况下会出错.没有的时候不知道.
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

//没发现如何使用整个jar包不混淆,所以只有一个一个加入了.只针对包,所以,如果你引入的jar包有很多的子包,就麻烦了.
-libraryjars D:\\libs\\commons-codec-1.4.jar
-libraryjars ./libs/apache-mime4j-core-0.7.jar
-libraryjars ./libs/httpmime-4.1.2.jar
-libraryjars ./libs/signpost-commonshttp4-1.2.1.1.jar
-libraryjars ./libs/signpost-core-1.2.1.1.jar

-keep public class org.apache.james.mime4j.** { public protected *; }
-keep public class org.apache.james.mime4j.codec.** { public protected *; }
-keep public class org.apache.james.mime4j.io.** { public protected *; }
-keep public class org.apache.james.mime4j.parser.** { public protected *; }
-keep public class org.apache.james.mime4j.stream.** { public protected *; }
-keep public class org.apache.james.mime4j.util.** { public protected *; }

-keep public class org.apache.http.entity.mime.** { public protected *; }
-keep public class org.apache.http.entity.mime.content.** { public protected *; }

-keep public class oauth.signpost.commonshttp.** { public protected *; }
-keep public class oauth.signpost.** { public protected *; }
-keep public class oauth.signpost.basic.** { public protected *; }
-keep public class oauth.signpost.exception.** { public protected *; }
-keep public class oauth.signpost.http.** { public protected *; }
-keep public class oauth.signpost.signature.** { public protected *; }

-keep public class com.google.gdata.util.common.base.** { public protected *; }


-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>;
}

-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.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

以上文件,使用Idea导出apk正常,Eclipse应该一样.

你可能感兴趣的:(ProGuard)