diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 2d147e84da..336140b797 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -79,8 +79,14 @@ -keep public class * extends android.preference.Preference -keep public class * extends android.view.View +-keep public class androidx.*{*;} +-keep public class * extends androidx.*{*;} +-keep interface androidx.* {*;} +-dontwarn androidx.** + -dontwarn android.support.design.** -keep public class android.support.design.R$* { *; } +-keep class com.google.android.material.* {*;} -keepclasseswithmembernames class * { native ; @@ -149,3 +155,135 @@ public static *** i(...); public static *** w(...); } + +#----------------------------------------第三方库---------------------------------------------- +#-----高德地图----- +#3D 地图 V5.0.0之后: +-keep class com.amap.api.maps.*{*;} +-keep class com.autonavi.*{*;} +-keep class com.amap.api.trace.*{*;} +#定位 +-keep class com.amap.api.location.*{*;} +-keep class com.amap.api.fence.*{*;} +-keep class com.autonavi.aps.amapapi.model.*{*;} +#搜索 +-keep class com.amap.api.services.*{*;} +#导航 +-keep class com.amap.api.navi.*{*;} +-keep class com.autonavi.*{*;} + +#-----Gson----- +-dontwarn sun.misc.** +# Application classes that will be serialized/deserialized over Gson +-keep class com.google.gson.examples.android.model.* { ; } +# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory, +# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) +-keep class * extends com.google.gson.TypeAdapter +-keep class * implements com.google.gson.TypeAdapterFactory +-keep class * implements com.google.gson.JsonSerializer +-keep class * implements com.google.gson.JsonDeserializer +# Prevent R8 from leaving Data object members always null +-keepclassmembers,allowobfuscation class * { + @com.google.gson.annotations.SerializedName ; +} + +#-----ARouter----- +-keep public class com.alibaba.android.arouter.routes.*{*;} +-keep public class com.alibaba.android.arouter.facade.*{*;} +-keep class * implements com.alibaba.android.arouter.facade.template.ISyringe{*;} +# If you use the byType method to obtain Service, add the following rules to protect the interface: +-keep interface * implements com.alibaba.android.arouter.facade.template.IProvider +# If single-type injection is used, that is, no interface is defined to implement IProvider, the following rules need to be added to protect the implementation +# -keep class * implements com.alibaba.android.arouter.facade.template.IProvider + +#-----Glide----- +-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.ImageHeaderParser$** { + **[] $VALUES; + public *; +} +#如果你的 target API 低于 Android API 27,请添加: +-dontwarn com.bumptech.glide.load.resource.bitmap.VideoDecoder + +#-----Fresco----- +-keep,allowobfuscation interface com.facebook.common.internal.DoNotStrip +-keep @com.facebook.common.internal.DoNotStrip class * +-keepclassmembers class * { + @com.facebook.common.internal.DoNotStrip *; +} +-keepclassmembers class * { + native ; +} +-dontwarn okio.** +-dontwarn com.squareup.okhttp.** +-dontwarn okhttp3.** +-dontwarn javax.annotation.** +-dontwarn com.android.volley.toolbox.** +-dontwarn com.facebook.infer.** + +#-----Okio----- +# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java. +-dontwarn org.codehaus.mojo.animal_sniffer.* + +#-----OkHttp----- +# JSR 305 annotations are for embedding nullability information. +-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 +# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java. +-dontwarn org.codehaus.mojo.animal_sniffer.* +# OkHttp platform used only on JVM and when Conscrypt dependency is available. +-dontwarn okhttp3.internal.platform.ConscryptPlatform + +#-----Retrofit----- +# Retrofit does reflection on method and parameter annotations. +-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations +# Retain service method parameters when optimizing. +-keepclassmembers,allowshrinking,allowobfuscation interface * { + @retrofit2.http.* ; +} +# Ignore annotation used for build tooling. +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement +# Ignore JSR 305 annotations for embedding nullability information. +-dontwarn javax.annotation.** +# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. +-dontwarn kotlin.Unit +# Top-level functions that can only be used by Kotlin. +-dontwarn retrofit2.KotlinExtensions.* +# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy +# and replaces all potential values with null. Explicitly keeping the interfaces prevents this. +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface <1> + +#-----ProtoBuf----- +-keep class com.google.protobuf.*{*;} + +#-----GSYVideoPlayer----- +-keep class tv.danmaku.ijk.* { *; } +-dontwarn tv.danmaku.ijk.** +-keep class com.shuyu.gsyvideoplayer.* { *; } +-dontwarn com.shuyu.gsyvideoplayer.** + +#-----EventBus----- +-keepattributes *Annotation* +-keepclassmembers class * { + @org.greenrobot.eventbus.Subscribe ; +} +-keep enum org.greenrobot.eventbus.ThreadMode { *; } +# And if you use AsyncExecutor: +-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent { + (java.lang.Throwable); +} + +#-----ZhiDaoService----- +-keep class com.zhidao.auto.*{*;} +-keep class com.zhidaohulian.*{*;} +-keep class com.elegant.analytics.*{*;} +-keep class com.zhidao.socketsdk.*{*;} +-keep class com.zhidao.ptech.*{*;} +-keep class com.zhidao.autopilot.support.*{*;} + + + +