原文地址:http://blog.csdn.net/chinavfeng/article/details/7287362

 

最近1个项目中 需要导入移动MM的第三方计费包,混淆时用到了如下脚本,可屏蔽警告,不混淆第三方包指定内容。

非常有效

 

proguard.cfg 文件

 

-optimizationpasses 5

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-ignorewarnings //这1句是屏蔽警告,脚本中把这行注释去掉
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

//这1句是导入第三方的类库,防止混淆时候读取包内容出错,脚本中把这行注释去掉

-libraryjars libs/mmbilling.jar

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

 

//这4句是不混淆第三方包中的指定内容,脚本中把这行注释去掉

-keep class com.ccit.** {*; }  

-keep class ccit.** { *; }
-keep class com.aspire.**
-keep class mm.vending.**