diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 40037dd..383761f 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -14,37 +14,28 @@ # Uncomment this to preserve the line number information for # debugging stack traces. -#-keepattributes SourceFile,LineNumberTable +-keepattributes SourceFile,LineNumberTable # If you keep the line number information, uncomment this to # hide the original source file name. #-renamesourcefileattribute SourceFile -# Kotlin Serialization: https://github.com/Kotlin/kotlinx.serialization#android +# General Kotlin Serialization rules +-keepattributes *Annotation*, InnerClasses +-dontnote kotlinx.serialization.AnnotationsKt -# 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; +# Kotlinx Serialization JSON-specific rules +-keepclassmembers class kotlinx.serialization.json.** { + *** Companion; } - -# Keep `serializer()` on companion objects (both default and named) of serializable classes. --if @kotlinx.serialization.Serializable class ** { - static **$* *; -} --keepclassmembers class <2>$<3> { +-keepclasseswithmembers class kotlinx.serialization.json.** { 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(...); -} +# Keep kotlinx.serialization internals +-keep class kotlinx.serialization.** { *; } -# @Serializable and @Polymorphic are used at runtime for polymorphic serialization. --keepattributes RuntimeVisibleAnnotations,AnnotationDefault +# Keep classes annotated with @Serializable +-keepclassmembers class * { + @kotlinx.serialization.Serializable *; +} \ No newline at end of file