From 01763556b19f2e8ed9e157b106b754f73acc1bda Mon Sep 17 00:00:00 2001 From: aminecmi Date: Tue, 13 Sep 2022 09:00:54 +0200 Subject: [PATCH] Fixed release build issues. --- androidApp/proguard-rules.pro | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/androidApp/proguard-rules.pro b/androidApp/proguard-rules.pro index 0b3ee7b..f7c7eff 100644 --- a/androidApp/proguard-rules.pro +++ b/androidApp/proguard-rules.pro @@ -55,11 +55,38 @@ public *; } --dontwarn com.anupcowkur.reservoir.** - -dontwarn javax.annotation.** -keep class android.support.v7.widget.SearchView { *; } # maybe remove later ? -keep class * extends androidx.fragment.app.Fragment + + +# 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 +