Android通过注解解决混淆问题

1.声明类,定义Target下面不被混淆

@Retention(RetentionPolicy.CLASS)
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD})
public @interface KeepNotProguard {
}

2.在混淆文件添加混淆配置

-keep @com.lss0555.example.KeepNotProguard class * {*;}
-keep class * {
    @com.lss0555.example.KeepNotProguard <fields>;
}
-keepclassmembers class * {
    @com.lss0555.example.KeepNotProguard <methods>;
}

3.使用
在类上加了@KeepNotProguard整个类便不会被混淆。

猜你喜欢

转载自blog.csdn.net/u010520146/article/details/82836305