New ProGuard implementation in #2983 causes R8 warning
Describe the bug
Since kotlinx-serialization-json v1.9.0, I get an R8 warning when building a release version of my Android app using Gradle.
I get the following warning:
The type "<1>$*" is used in a field rule. The characters in this type are legal for the JVM, but unlikely to originate from a source language. Maybe this is not the rule you are looking for.
When checking the configuration.txt file in the mapping folder (when compiling using Android Studio), I see exactly one occurrence of the <1>$* string. It occurs only in the r8\kotlinx-serialization-common.pro file.
It looks like this is introduced since #2983 (specifically, in this commit: https://github.com/Kotlin/kotlinx.serialization/pull/2983/commits/666595327ace9a880b6c256f6aa10b9b0a6884c2)
Is this a reason to rollback to the previous version? Or is there something I should change in my code to prevent this?
Environment
- Kotlin version: [2.0.21]
- Library version: [1.9.0]
- Kotlin platforms: [JVM 21.0.6]
- Gradle version: [8.13]
- IDE version [Android Studio 2025.1.1]
- Targeting Android SDK 36, compiling using SDK 36, minimum SDK 31
cc @shanshin
Rule looks correct though, because class generated by serialization plugin is called $serializer. Maybe this warning should be suppressed somehow.
Interesting. The warning was introduced as a fix to https://issuetracker.google.com/110021323 in https://r8-review.googlesource.com/23190. It looks as if R8 think that the <>'s are not matching or is not a valid back reference.
Do you have a reproduction that the R8 team can test with?
Interesting. The warning was introduced as a fix to https://issuetracker.google.com/110021323 in https://r8-review.googlesource.com/23190. It looks as if R8 think that the <>'s are not matching or is not a valid back reference.
Do you have a reproduction that the R8 team can test with?
I do not have a small reproduction code, but I think it is enough to create an empty project, add one Kotlin data class and mark it as @Serializable, and run a release build with isMinifyEnabled = true and isShrinkResources = true.
Anyone found a workaround about this or the only solution is the downgrade?
I'm also facing the same issue. Is there an update on this?
Opened an R8 issue on this https://issuetracker.google.com/433451526.
The fix is in https://r8-review.googlesource.com/c/r8/+/107501. I will ping this issue when it has landed.
The warning is benign, and can be ignored until the fix is ready.