# Runic Gateway Android app — ProGuard/R8 rules (release minify + resource shrink, M6). # # The dependency stack ships its own consumer rules that R8 applies automatically: # Retrofit 2.11, OkHttp 4.12, kotlinx.serialization 1.7 (core), Hilt/Dagger, Coil 2.7. # The rules below are defensive belt-and-suspenders for the areas full-mode R8 is # most likely to over-strip in this app: the kotlinx.serialization generated # serializers and our own @Serializable wire DTOs. # ── kotlinx.serialization (canonical keep rules) ──────────────────────────── -keepattributes *Annotation*, InnerClasses -dontnote kotlinx.serialization.** # Keep the Companion of @Serializable classes so `.serializer()` resolves. -if @kotlinx.serialization.Serializable class ** -keepclassmembers class <1> { static <1>$Companion Companion; } -if @kotlinx.serialization.Serializable class ** { static **$Companion Companion; } -keepclassmembers class <2>$Companion { kotlinx.serialization.KSerializer serializer(...); } # Keep `INSTANCE.serializer()` of @Serializable objects. -if @kotlinx.serialization.Serializable class ** { public static ** INSTANCE; } -keepclassmembers class <1> { public static <1> INSTANCE; kotlinx.serialization.KSerializer serializer(...); } # Keep the synthesized $$serializer classes and their descriptor field. -keepclassmembers class **$$serializer { *** descriptor; } # ── Our wire DTOs ─────────────────────────────────────────────────────────── # All request/response models decoded by kotlinx.serialization. Keeping them # (and their generated serializers) guarantees additive backend fields and # @SerialName mappings survive minification. DTOs are small, so keeping them # whole is cheap insurance against a full-mode strip. -keep @kotlinx.serialization.Serializable class com.runicgateway.app.** { *; } -keepclassmembers class com.runicgateway.app.data.api.dto.** { *; } # ── Retrofit service interfaces ───────────────────────────────────────────── # Retrofit reads method + parameter annotations reflectively; keep our API # interfaces' generic signatures so return types (suspend .../Call) resolve. -keep,allowobfuscation interface com.runicgateway.app.data.api.*Api -keepattributes Signature, Exceptions # Kotlin metadata is needed for reflection over Kotlin types (serialization/Retrofit). -keep class kotlin.Metadata { *; } # ── Tink / EncryptedSharedPreferences (androidx.security-crypto) ───────────── # Tink references Error Prone compile-only annotations that are absent at runtime; # they are safe to ignore (they carry no runtime behaviour). Suppresses the R8 # "Missing class com.google.errorprone.annotations.*" errors. -dontwarn com.google.errorprone.annotations.**