最近1个项目中 需要导入移动MM的第三方计费包,混淆时用到了如下脚本,可屏蔽警告,不混淆第三方包指定内容。
非常有效
proguard.cfg 文件
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-ignorewarnings //这1句是屏蔽警告,脚本中把这行注释去掉
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-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
-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;
}
native
}
-keepclasseswithmembernames class * {
public(android.content.Context, android.util.AttributeSet);
}
public
}
-keepclasseswithmembernames class * {
public(android.content.Context, android.util.AttributeSet, int);
}
public
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
public static final android.os.Parcelable$Creator *;
}
-keep class com.ccit.** {*; }
-keep class ccit.** { *; }
-keep class com.aspire.**
-keep class mm.vending.**
Error Message: '-jar' is not recognized as an internal or external command,
Solution: set up the "PROGUARD_HOME" EVN PATH to \tools\proguard 2, restart eclipse 3, now it work fine!
No comments:
Post a Comment