2021-11-07 16:50:28 +08:00
|
|
|
# Add project specific ProGuard rules here.
|
|
|
|
# You can control the set of applied configuration files using the
|
|
|
|
# proguardFiles setting in build.gradle.
|
|
|
|
#
|
|
|
|
# For more details, see
|
|
|
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
|
|
|
|
|
|
# If your project uses WebView with JS, uncomment the following
|
|
|
|
# and specify the fully qualified class name to the JavaScript interface
|
|
|
|
# class:
|
|
|
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
|
|
# public *;
|
|
|
|
#}
|
|
|
|
|
2023-11-22 17:16:37 +08:00
|
|
|
# Uncomment this to preserve the line number information for debugging stack traces.
|
|
|
|
-keepattributes SourceFile,LineNumberTable
|
2021-11-07 16:50:28 +08:00
|
|
|
|
2023-11-22 17:16:37 +08:00
|
|
|
# If you keep the line number information, uncomment this to hide the original source file name.
|
|
|
|
-renamesourcefileattribute SourceFile
|
2021-12-14 11:34:20 +08:00
|
|
|
|
2023-11-22 17:16:37 +08:00
|
|
|
# self
|
|
|
|
-keep class li.songe.**{*;}
|
|
|
|
-keep interface li.songe.**{*;}
|
|
|
|
|
|
|
|
-keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod
|
|
|
|
|
|
|
|
-keep, allowobfuscation, allowoptimization @kotlinx.serialization.Serializable class * {*;}
|
|
|
|
|
|
|
|
## Android architecture components: Lifecycle
|
|
|
|
# LifecycleObserver's empty constructor is considered to be unused by proguard
|
|
|
|
-keepclassmembers class * implements androidx.lifecycle.LifecycleObserver {
|
|
|
|
<init>(...);
|
|
|
|
}
|
|
|
|
# ViewModel's empty constructor is considered to be unused by proguard
|
|
|
|
-keepclassmembers class * extends androidx.lifecycle.ViewModel {
|
|
|
|
<init>(...);
|
|
|
|
}
|
|
|
|
# keep methods annotated with @OnLifecycleEvent even if they seem to be unused
|
|
|
|
# (Mostly for LiveData.LifecycleBoundObserver.onStateChange(), but who knows)
|
|
|
|
-keepclassmembers class * {
|
|
|
|
@androidx.lifecycle.OnLifecycleEvent *;
|
|
|
|
}
|
|
|
|
|
|
|
|
# https://github.com/ktorio/ktor/issues/379
|
|
|
|
-keep class kotlin.reflect.jvm.internal.** { *; }
|
|
|
|
|
|
|
|
# https://github.com/ktorio/ktor-documentation/blob/2.3.6/codeSnippets/snippets/proguard/proguard.pro
|
|
|
|
-keep class io.ktor.server.cio.EngineMain { *; }
|
|
|
|
-keep class io.ktor.server.config.HoconConfigLoader { *; }
|
|
|
|
-keep class io.ktor.serialization.kotlinx.json.KotlinxSerializationJsonExtensionProvider { *; }
|
|
|
|
|
|
|
|
# kotlin
|
|
|
|
-keep class kotlin.** { *; }
|
|
|
|
-keep class kotlin.Metadata { *; }
|
2024-10-22 22:10:13 +08:00
|
|
|
-keep class kotlin.text.RegexOption { *; }
|
2023-11-22 17:16:37 +08:00
|
|
|
-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);
|
|
|
|
}
|
|
|
|
|
|
|
|
# gradle build error log
|
|
|
|
-dontwarn java.lang.management.ManagementFactory**
|
|
|
|
-dontwarn java.lang.management.RuntimeMXBean**
|
|
|
|
-dontwarn org.slf4j.impl.StaticLoggerBinder**
|
|
|
|
-dontwarn org.slf4j.impl.StaticMDCBinder**
|
|
|
|
|
|
|
|
# <mmkv-
|
|
|
|
# https://github.com/Tencent/MMKV/blob/master/Android/MMKV/mmkv/proguard-rules.pro
|
|
|
|
-keepclasseswithmembers,includedescriptorclasses class com.tencent.mmkv.** {
|
|
|
|
native <methods>;
|
|
|
|
long nativeHandle;
|
|
|
|
private static *** onMMKVCRCCheckFail(***);
|
|
|
|
private static *** onMMKVFileLengthError(***);
|
|
|
|
private static *** mmkvLogImp(...);
|
|
|
|
private static *** onContentChangedByOuterProcess(***);
|
|
|
|
}
|
|
|
|
# -mmkv>
|
|
|
|
|
|
|
|
# <okhttp3-
|
|
|
|
# https://github.com/square/okhttp/blob/master/okhttp/src/jvmMain/resources/META-INF/proguard/okhttp3.pro
|
|
|
|
# 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.
|
|
|
|
-adaptresourcefilenames okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz
|
|
|
|
|
|
|
|
# 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 and other security providers are available.
|
|
|
|
-dontwarn okhttp3.internal.platform.**
|
|
|
|
-dontwarn org.conscrypt.**
|
|
|
|
-dontwarn org.bouncycastle.**
|
|
|
|
-dontwarn org.openjsse.**
|
|
|
|
# -okhttp3>
|
|
|
|
|
|
|
|
# <kotlinx.coroutines-
|
|
|
|
# https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/resources/META-INF/proguard/coroutines.pro
|
|
|
|
# When editing this file, update the following files as well:
|
|
|
|
# - META-INF/com.android.tools/proguard/coroutines.pro
|
|
|
|
# - META-INF/com.android.tools/r8/coroutines.pro
|
|
|
|
-keep class kotlinx.coroutines.** {*;}
|
|
|
|
|
|
|
|
# ServiceLoader support
|
|
|
|
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
|
|
|
|
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
|
|
|
|
-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {}
|
|
|
|
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}
|
|
|
|
|
|
|
|
# Most of volatile fields are updated with AFU and should not be mangled
|
|
|
|
-keepclassmembers class kotlinx.coroutines.** {
|
|
|
|
volatile <fields>;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Same story for the standard library's SafeContinuation that also uses AtomicReferenceFieldUpdater
|
|
|
|
-keepclassmembers class kotlin.coroutines.SafeContinuation {
|
|
|
|
volatile <fields>;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Only used in `kotlinx.coroutines.internal.ExceptionsConstructor`.
|
|
|
|
# The case when it is not available is hidden in a `try`-`catch`, as well as a check for Android.
|
|
|
|
-dontwarn java.lang.ClassValue
|
|
|
|
# -kotlinx.coroutines>
|