查看原文
其他

Android混淆规则

哆啦安全 2022-06-09

-ignorewarnings # 忽略警告-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# 保持 native 方法不被混淆-keepclasseswithmembernames class * { 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);}# 保持枚举 enum 类不被混淆-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String);}#保持Parcelable不被混淆-keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *;}# Explicitly preserve all serialization members. The Serializable interface# is only a marker interface, so it wouldn't save them.# 保持序列号类不被混淆-keep public class * implements java.io.Serializable {*;}-keepclassmembers class * implements java.io.Serializable { static final long serialVersionUID; private static final java.io.ObjectStreamField[] serialPersistentFields; private void writeObject(java.io.ObjectOutputStream); private void readObject(java.io.ObjectInputStream); java.lang.Object writeReplace(); java.lang.Object readResolve();}



推荐阅读

超实用的优质公众号推荐

学抓包就来"哆啦安全"学

Android应用安全方案梳理

Android APK和API漏洞扫描器

玩转Android adb命令(adb降级)

检测Android手机病毒的方法浅析

Android App开发Bug解决完美方案

JNI与NDK编程(基础到精通)最全总结

Android系统run-as命令原理(权限访问)

Android11以上手机小程序抓包解决方案

Android系统中run-as和su命令的源码解析(升降权限)

Android系统定制之Android.mk和Android.bp语法详解(精通版)


您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存