Skip to content

Commit

Permalink
Fixed keeping INSTANCE field and serializer function for serializable…
Browse files Browse the repository at this point in the history
… objects in R8 full mode (#2865)

Details https://issuetracker.google.com/issues/379996140

Fixes #2861
  • Loading branch information
shanshin authored Nov 25, 2024
1 parent 1758faa commit 1b0accd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rules/r8.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,16 @@

-if @kotlinx.serialization.Serializable class **
-keep, allowshrinking, allowoptimization, allowobfuscation, allowaccessmodification class <1>


# Rule to save INSTANCE field and serializer function for Kotlin serializable objects.
#
# R8 full mode works differently if the instance is not explicitly accessed in the code.
#
# see https://github.com/Kotlin/kotlinx.serialization/issues/2861
# see https://issuetracker.google.com/issues/379996140

-keepclassmembers @kotlinx.serialization.Serializable class ** {
public static ** INSTANCE;
kotlinx.serialization.KSerializer serializer(...);
}

0 comments on commit 1b0accd

Please sign in to comment.