步奏1.开启混淆标志
Android Studio混淆代码打包
步奏2.编写混淆规则文件:proguard-rules.pro

Android Studio混淆代码打包

混淆基本规范:

忽略警告
-ignorewarning

是否使用大小写混合
-dontusemixedcaseclassnames

预校验
-dontpreverify

保持枚举 enum 类不被混淆
-keepclassmembers enum * {*;}

抛出异常时保留代码行号
-keepattributes SourceFile,LineNumberTable

保持 native 方法不被混淆
-keepclasseswithmembernames class * {
native ;
}

保持 Parcelable 不被混淆
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

——– Gson 相关的混淆配置——–

-keepattributes Signature
-keepattributes Annotation
-keep class sun.misc.Unsafe { *; }

所有在web界面使用的封装对象不能混淆

步奏3.打包
Android Studio混淆代码打包

相关文章:

  • 2022-12-23
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2021-09-03
  • 2022-01-18
  • 2022-02-08
猜你喜欢
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2021-09-16
  • 2022-12-23
相关资源
相似解决方案