# ============================================================ # baselibrary 库模块自身的混淆规则(仅当 baselibrary 的 minifyEnabled=true 时生效) # 注意:对 App 模块生效的规则写在 consumer-rules.pro 中 # ============================================================ # 保留注解、泛型签名、运行时注解(网络层反射核心属性) -keepattributes Signature,*Annotation*,AnnotationDefault,RuntimeVisibleAnnotations,RuntimeVisibleParameterAnnotations,InnerClasses,EnclosingMethod # BaseNetworkApi 反射泛型基类 -keep class com.abbidot.baselibrary.network.base.BaseNetworkApi { *; } -keep class * extends com.abbidot.baselibrary.network.base.BaseNetworkApi { *; } -keep interface com.abbidot.baselibrary.network.base.IService { *; } # BaseResponse 网络响应泛型基类 -keep class com.abbidot.baselibrary.network.base.BaseResponse { *; } # Gson TypeAdapter -keep class com.abbidot.baselibrary.network.interceptor.StringNullAdapter { *; } -keep class com.abbidot.baselibrary.network.interceptor.DoubleDefault0Adapter { *; } # OkHttp Interceptor -keep class com.abbidot.baselibrary.network.interceptor.CommonRequestInterceptor { *; } -keep class com.abbidot.baselibrary.network.interceptor.CommonResponseInterceptor { *; } # 异常类 -keep class com.abbidot.baselibrary.network.exception.** { *; } # 公共工具类(反射用到的保留) -keep class com.abbidot.baselibrary.util.** { *; } -keep class com.abbidot.baselibrary.constant.** { *; } # EventBus -keep class com.abbidot.baselibrary.eventbus.** { *; } # RecyclerView 公共基类 -keep class com.abbidot.baselibrary.list.** { *; } # Retrofit + Gson + OkHttp -keep,allowobfuscation,allowshrinking interface retrofit2.Call -keep,allowobfuscation,allowshrinking class retrofit2.Response -keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation -if interface * { @retrofit2.http.* ; } -keep,allowobfuscation interface * { ; } -keep class com.google.gson.** { *; } -keep class com.google.gson.reflect.TypeToken { *; } -keep class * extends com.google.gson.reflect.TypeToken { *; } -dontwarn okhttp3.internal.platform.** -dontwarn org.conscrypt.** -dontwarn org.bouncycastle.** -dontwarn org.openjsse.** -dontwarn org.codehaus.mojo.animal_sniffer.* -dontwarn com.google.gson.** # ============================== # 自定义 View / LayoutInflater 反射构造函数保留 # ============================== -keepclassmembers class * extends android.view.View { public (android.content.Context, android.util.AttributeSet); public (android.content.Context, android.util.AttributeSet, int); public (android.content.Context, android.util.AttributeSet, int, int); void set*(***); *** get*(); } -keepclassmembers class * extends android.view.ViewGroup { public (android.content.Context, android.util.AttributeSet); public (android.content.Context, android.util.AttributeSet, int); public (android.content.Context, android.util.AttributeSet, int, int); } -keep class com.abbidot.baselibrary.widget.** { *; }