android使用proguard

废话不多说了,直接放上文件:

-optimizationpasses5

-dontusemixedcaseclassnames

-dontskipnonpubliclibraryclasses如果没有这句,在有libs的情况下会出错.没有的时候不知道.

-dontpreverify

-verbose

-optimizations!code/simplification/arithmetic,!field/*,!class/merging/*

//没发现如何使用整个jar包不混淆,所以只有一个一个加入了.只针对包,所以,如果你引入的jar包有很多的子包,就麻烦了.

-libraryjarsD:\\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

-keeppublicclassorg.apache.james.mime4j.**{publicprotected*;}

-keeppublicclassorg.apache.james.mime4j.codec.**{publicprotected*;}

-keeppublicclassorg.apache.james.mime4j.io.**{publicprotected*;}

-keeppublicclassorg.apache.james.mime4j.parser.**{publicprotected*;}

-keeppublicclassorg.apache.james.mime4j.stream.**{publicprotected*;}

-keeppublicclassorg.apache.james.mime4j.util.**{publicprotected*;}

-keeppublicclassorg.apache.http.entity.mime.**{publicprotected*;}

-keeppublicclassorg.apache.http.entity.mime.content.**{publicprotected*;}

-keeppublicclassoauth.signpost.commonshttp.**{publicprotected*;}

-keeppublicclassoauth.signpost.**{publicprotected*;}

-keeppublicclassoauth.signpost.basic.**{publicprotected*;}

-keeppublicclassoauth.signpost.exception.**{publicprotected*;}

-keeppublicclassoauth.signpost.http.**{publicprotected*;}

-keeppublicclassoauth.signpost.signature.**{publicprotected*;}

-keeppublicclasscom.google.gdata.util.common.base.**{publicprotected*;}

-keeppublicclass*extendsandroid.app.Activity

-keeppublicclass*extendsandroid.app.Application

-keeppublicclass*extendsandroid.app.Service

-keeppublicclass*extendsandroid.content.BroadcastReceiver

-keeppublicclass*extendsandroid.content.ContentProvider

-keeppublicclass*extendsandroid.app.backup.BackupAgentHelper

-keeppublicclass*extendsandroid.preference.Preference

-keeppublicclasscom.android.vending.licensing.ILicensingService

-keepclasseswithmembernamesclass*{

native<methods>;

}

-keepclasseswithmembersclass*{

public<init>(android.content.Context,android.util.AttributeSet);

}

-keepclasseswithmembersclass*{

public<init>(android.content.Context,android.util.AttributeSet,int);

}

-keepclassmembersclass*extendsandroid.app.Activity{

publicvoid*(android.view.View);

}

-keepclassmembersenum*{

publicstatic**[]values();

publicstatic**valueOf(java.lang.String);

}

-keepclass*implementsandroid.os.Parcelable{

publicstaticfinalandroid.os.Parcelable$Creator*;

}

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

相关推荐