Dowemo
0 0 0 0

1, add in the build. Grandle, where rules are written in rules. Pro, or you can customize a file to replace, such as proguard-project. Txt commonly used for eclipse.
buildTypes {
 release {
 signingConfig signingConfigs.release
 minifyEnabled true
 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
 }
}
2, adding the following code in the rule. Pro, which basically covers all of the following.
-optimizationpasses 5 # 指定代码的压缩级别
-dontusemixedcaseclassnames # 是否使用大小写混合
-dontpreverify # 混淆时是否做预校验
-verbose # 混淆时是否记录日志
-optimizations!code/simplification/arithmetic,!field/*,!class/merging/* # 混淆时所采用的算法
-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 方法不被混淆
 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 * { # 保持枚举 enum 类不被混淆 
 public static **[] values(); 
 public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable { # 保持 Parcelable 不被混淆 
 public static final android.os.Parcelable$Creator *;
}
3, when the code is confused by java.io. studio, the in the lib directory has been added to the packaging script by default, so you don't need to add it again; otherwise,"ioexception: the same input jar is specified twice"error. 4. Third party needs to find a class that can't be confused by third-party web sites.





Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs