Skip to content

Instantly share code, notes, and snippets.

@brucetoo
Created January 3, 2018 10:36
Show Gist options
  • Save brucetoo/653c7e246335a883ceddcc588eb9096f to your computer and use it in GitHub Desktop.
Save brucetoo/653c7e246335a883ceddcc588eb9096f to your computer and use it in GitHub Desktop.
Android proguard optimize
1.保存唯一唯一的包名
-keepattributes InnerClasses,...
-keeppackagenames **
2.防止有些资源没被混淆
#-dontshrink
3.去掉抛出异常时保留代码行数
#-keepattributes SourceFile,LineNumberTable
4.去掉代码中的Log日志
#Android自身的
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** i(...);
public static *** w(...);
public static *** e(...);
}
#代码中的工具类
-assumenosideeffects class com.**.Logger {
public static *** d(...);
public static *** v(...);
public static *** i(...);
public static *** w(...);
public static *** e(...);
}
#去掉异常的抛出点
-assumenosideeffects class * extends java.lang.Throwable {
public void printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment