Describe the bug
I am having a KMM project in which I need to enable Proguard for my release mode. As soon as I enable isMinifyEnabled = true in my android module build.gradle file I get this error :- Serializer for class 'e' is not found.
Mark the class as @Serializable or provide the serializer explicitly.
Now I already have gone through this issue and had the same Proguard rules applied in my project but I am still unable to solve this.
To Reproduce
Proguard Rules :-
-keepattributes *Annotation*, InnerClasses
-dontnote kotlinx.serialization.SerializationKt
-keep,includedescriptorclasses class <My Package Name>**$$serializer { *; } # <-- change package name to your app's
-keepclassmembers class <My Package Name>.** { # <-- change package name to your app's
*** Companion;
}
-keepclasseswithmembers class <My Package Name>.** { # <-- change package name to your app's
kotlinx.serialization.KSerializer serializer(...);
}
I don't get any crashes or any Logs in my logcat but I can see the error simply printing in my device which says :- Serializer for class 'e' is not found.
Mark the class as @Serializable or provide the serializer explicitly.
I can even see my Model class print as it is.
Expected behavior
App should work as it is while having minifyEnabled as true
Environment
Kotlin version: 1.4.30-M1
Library version: 1.1.0
Kotlin platforms: Kotlin/JVM (Android)
Gradle version: 6.5
IDE version :- Android Studio Arctic Fox | 2020.3.1 Beta 3
Issue has been resolved. the main problem was I needed to setup consumerProguardFiles in my shared module. As soon as I setup that this works perferctly.
Describe the bug I am having a KMM project in which I need to enable Proguard for my release mode. As soon as I enable
isMinifyEnabled = true
in myandroid
modulebuild.gradle
file I get this error :- Serializer for class 'e' is not found. Mark the class as @Serializable or provide the serializer explicitly.Now I already have gone through this issue and had the same Proguard rules applied in my project but I am still unable to solve this. To Reproduce Proguard Rules :-
I don't get any crashes or any Logs in my logcat but I can see the error simply printing in my device which says :- Serializer for class 'e' is not found. Mark the class as @Serializable or provide the serializer explicitly.
I can even see my Model class print as it is.
Expected behavior App should work as it is while having minifyEnabled as true
Environment