AndroidStudio中常用框架代码混淆配置

来源:互联网 发布:pads是什么软件 编辑:程序博客网 时间:2024/06/06 05:19

androidstdio中常用框架代码混淆配置:
1.OkHttp
版本: compile ‘com.squareup.okhttp3:okhttp:3.9.1’
混淆配置:

-dontwarn okhttp3.**-dontwarn okio.**-dontwarn javax.annotation.**# A resource is loaded with a relative path so the package of this class must be preserved.-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

2.Retrofit
版本:compile ‘com.squareup.retrofit2:retrofit:2.3.0’
混淆配置:

-dontwarn okio.**-dontwarn javax.annotation.**-dontwarn sun.misc.**-dontwarn sorg.codehaus.mojo.animal_sniffer.**-dontwarn org.codehaus.**-dontwarn java.nio.**-dontwarn java.lang.invoke.**

3.EventBus
版本: compile ‘org.greenrobot:eventbus:3.1.1’
混淆配置:

-keepattributes *Annotation*-keepclassmembers class ** {    @org.greenrobot.eventbus.Subscribe <methods>;}-keep enum org.greenrobot.eventbus.ThreadMode { *; }# Only required if you use AsyncExecutor-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {    <init>(java.lang.Throwable);}

4.Glide
版本: compile ‘com.github.bumptech.glide:glide:3.7.0’
混淆配置:

-keep public class * implements com.bumptech.glide.module.GlideModule-keep public class * extends com.bumptech.glide.module.AppGlideModule-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {  **[] $VALUES;  public *;}

5.fastJson
版本:compile ‘com.alibaba:fastjson:1.1.67.android’
混淆配置:

-keepattributes Signature-dontwarn com.alibaba.fastjson.**-keep class com.alibaba.fastjson.**{*; }# 这儿的“com.android.beandao”是自己的bean包-keep class com.android.beandao.**{ *; }
原创粉丝点击