Hello Kotlin Team, I'm currently experimenting wit...
# multiplatform
a
Hello Kotlin Team, I'm currently experimenting with a Kotlin Multiplatform library and have encountered an issue related to Proguard usage in release builds. My current setup (which works correctly): • AGP: 8.5.2 • Kotlin: 2.0.20 In this setup, when consuming the library, the
.kotlin_module
file inside the META-INF folder is correctly included in the generated AAR file, and the library is recognized as Kotlin. However, upon updating to a higher version of either AGP or Kotlin, I've noticed an issue: • After applying Proguard, the
.kotlin_module
file disappears from the META-INF folder within
classes.jar
inside the AAR. • Consequently, the library is recognized as Java instead of Kotlin upon consumption. If I disable Proguard, everything functions correctly, and the
.kotlin_module
file remains present, but disabling Proguard permanently is not an option for us. I've already tried adding the following Proguard rule without success:
Copy code
-keep class kotlin.Metadata
Could you please advise on how to resolve this issue, or indicate if there's a known solution or workaround? Thank you very much for your assistance!
Copy code
# Add this option to tell ProGuard to keep and adapt Kotlin metadata
-keep class kotlin.Metadata { *; }
-keepattributes *Annotation*, InnerClasses
-keepnames class * {
    @kotlin.Metadata *;
}
I'm trying this.