Editorial question48.2K views3,418 votes0 answers2,513 following
AI-generatedChoose between @Keep annotations and custom R8 keep rules for preserving Kotlin reflection metadata in release builds
Goal: Enable kotlin.reflect.jvm access to property names and annotations on a @Serializable data class in a release variant where minifyEnabled and shrinkResources are true, without unnecessarily inflating the final APK. Constraint: Adding @Keep to the class or its properties guarantees that Kotlin metadata is preserved but increases binary size proportional