TiebaLite/app/proguard-rules.pro

259 lines
8.8 KiB
Prolog
Raw Normal View History

2020-04-05 13:15:03 +08:00
# 代码混淆压缩比在0~7之间
-optimizationpasses 5
# 混合时不使用大小写混合,混合后的类名为小写
-dontusemixedcaseclassnames
# 指定不去忽略非公共库的类
-dontskipnonpubliclibraryclasses
# 不做预校验preverify是proguard的四个步骤之一Android不需要preverify去掉这一步能够加快混淆速度
-dontpreverify
-verbose
#google推荐算法
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
# 避免混淆Annotation内部类泛型匿名类
2022-08-06 09:40:06 +08:00
-keepattributes *Annotation*,InnerClasses,Signature,EnclosingMethod,Exceptions
2020-04-05 13:15:03 +08:00
# 重命名抛出异常时的文件名称
2022-08-06 09:40:06 +08:00
-renamesourcefileattribute Source
2020-04-05 13:15:03 +08:00
# 抛出异常时保留代码行号
-keepattributes SourceFile,LineNumberTable
# 保持自定义控件类不被混淆
2022-08-06 09:40:06 +08:00
-keepclassmembers class * extends android.view.View {
2020-04-05 13:15:03 +08:00
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
2022-08-06 09:40:06 +08:00
public <init>(android.content.Context, android.util.AttributeSet, int, int);
2020-04-05 13:15:03 +08:00
public void set*(...);
*** get*();
}
# 保留R下面的资源
-keep class **.R$* {*;}
# 保留四大组件自定义的Application等这些类不被混淆
2022-08-06 09:40:06 +08:00
# -keep public class * extends android.app.Fragment
2020-04-05 13:15:03 +08:00
-keep public class * extends android.app.Activity
2022-08-06 09:40:06 +08:00
-keep public class * extends android.app.Application
2020-04-05 13:15:03 +08:00
-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.preference.Preference
# 保留在Activity中的方法参数是view的方法
# 这样以来我们在layout中写的onClick就不会被影响
-keepclassmembers class * extends android.app.Activity{
public void *(android.view.View);
}
# 对于带有回调函数的onXXEvent、**On*Listener的,不能被混淆
-keepclassmembers class * {
void *(**On*Event);
void *(**On*Listener);
}
# 保留本地native方法不被混淆
2021-08-19 17:25:05 +08:00
-keepclasseswithmembers class * {
2020-04-05 13:15:03 +08:00
native <methods>;
}
# 保留枚举类不被混淆
-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 *;
}
-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();
}
2022-08-06 09:40:06 +08:00
2020-04-05 13:15:03 +08:00
#assume no side effects:删除android.util.Log输出的日志
-assumenosideeffects class android.util.Log {
public static *** v(...);
public static *** d(...);
public static *** i(...);
public static *** w(...);
public static *** e(...);
}
# WebView
-keepclassmembers class * extends android.webkit.WebViewClient {
public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
public boolean *(android.webkit.WebView, java.lang.String);
}
-keepclassmembers class * extends android.webkit.WebViewClient {
2022-08-06 09:40:06 +08:00
public void *(android.webkit.WebView, java.lang.String);
2020-04-05 13:15:03 +08:00
}
# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**
# 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
-keep class cn.jzvd.*{*;}
2020-07-16 15:58:05 +08:00
-keep class com.gyf.immersionbar.* {*;}
-dontwarn com.gyf.immersionbar.**
2020-04-05 13:15:03 +08:00
-keep class com.huanchengfly.tieba.post.models.** { *; }
2020-08-15 22:05:07 +08:00
-keep class com.huanchengfly.tieba.post.api.models.** { *; }
2020-04-05 13:15:03 +08:00
-keep public class com.huanchengfly.tieba.post.utils.TiebaLiteJavaScript { *; }
-dontwarn com.yanzhenjie.permission.**
-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 *;
}
# LitePal相关
-keep class org.litepal.** {
*;
}
-keep class * extends org.litepal.crud.LitePalSupport {
*;
}
-keep class * implements com.google.gson.JsonDeserializer {
*;
}
# Matisse
-dontwarn com.squareup.picasso.**
-dontwarn com.zhihu.matisse.**
-keep class com.zhihu.matisse.**{*;}
-keep class com.lijiankun24.** { *; }
# uCrop
-dontwarn com.yalantis.ucrop**
-keep class com.yalantis.ucrop** { *; }
-keep interface com.yalantis.ucrop** { *; }
# kotlin
-keep class kotlin.** { *; }
-keep class kotlin.Metadata { *; }
-dontwarn kotlin.**
-keepclassmembers class **$WhenMappings {
<fields>;
}
-keepclassmembers class kotlin.Metadata {
public <methods>;
}
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
}
# OkHttp3
-dontwarn okhttp3.logging.**
-keep class okhttp3.internal.**{*;}
-dontwarn okio.**
# Retrofit
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
2020-08-22 22:22:06 +08:00
-keep class com.alibaba.android.vlayout.ExposeLinearLayoutManagerEx { *; }
2022-08-06 09:40:06 +08:00
-keep class androidx.recyclerview.widget.RecyclerView$LayoutManager { *; }
2020-08-22 22:22:06 +08:00
-keep class androidx.recyclerview.widget.RecyclerView$LayoutParams { *; }
-keep class androidx.recyclerview.widget.RecyclerView$ViewHolder { *; }
2022-08-06 09:40:06 +08:00
-keep class androidx.recyclerview.widget.ChildHelper { *; }
-keep class androidx.recyclerview.widget.ChildHelper$Bucket { *; }
2021-08-19 17:25:05 +08:00
-keep class com.huanchengfly.tieba.post.plugins.** { *; }
2022-08-30 09:10:13 +08:00
-keep class com.squareup.wire.** { *; }
2022-09-24 16:05:21 +08:00
# Keep `Companion` object fields of serializable classes.
# This avoids serializer lookup through `getDeclaredClasses` as done for named companion objects.
-if @kotlinx.serialization.Serializable class **
-keepclassmembers class <1> {
static <1>$Companion Companion;
}
# Keep `serializer()` on companion objects (both default and named) of serializable classes.
-if @kotlinx.serialization.Serializable class ** {
static **$* *;
}
-keepclassmembers class <2>$<3> {
kotlinx.serialization.KSerializer serializer(...);
}
# Keep `INSTANCE.serializer()` of serializable objects.
-if @kotlinx.serialization.Serializable class ** {
public static ** INSTANCE;
}
-keepclassmembers class <1> {
public static <1> INSTANCE;
kotlinx.serialization.KSerializer serializer(...);
}
# @Serializable and @Polymorphic are used at runtime for polymorphic serialization.
-keepattributes RuntimeVisibleAnnotations,AnnotationDefault
# Serializer for classes with named companion objects are retrieved using `getDeclaredClasses`.
# If you have any, uncomment and replace classes with those containing named companion objects.
#-keepattributes InnerClasses # Needed for `getDeclaredClasses`.
#-if @kotlinx.serialization.Serializable class
#com.example.myapplication.HasNamedCompanion, # <-- List serializable classes with named companions.
#com.example.myapplication.HasNamedCompanion2
#{
# static **$* *;
#}
#-keepnames class <1>$$serializer { # -keepnames suffices; class is kept when serializer() is kept.
# static <1>$$serializer INSTANCE;
#}
2022-12-31 12:43:24 +08:00
-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.Conscrypt$Version
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE
# Compose Runtime Tracing
-assumenosideeffects public class androidx.compose.runtime.ComposerKt {
boolean isTraceInProgress();
void traceEventStart(int,int,int,java.lang.String);
void traceEventStart(int,java.lang.String);
void traceEventEnd();
}