# R8 rules for release builds (isMinifyEnabled = true). # # Most of what this app depends on ships its own consumer rules inside the AAR/JAR — # Retrofit, OkHttp, Coil, Media3 and kotlinx.serialization all do. What follows is the # part that is ours, plus a little insurance around reflection-shaped code. # --- kotlinx.serialization ----------------------------------------------------------- # Every wire model is @Serializable and the gateway contract is pinned by field name, so # a stripped or renamed serializer is a silent parse failure at runtime rather than a # build error. The same models are also persisted to DataStore as JSON, which means an # existing install decodes a blob written by the previous build. # # These rules match on the *annotation*, not on a package list. The previous version # enumerated com.mattcohen.embyscreensaver.data.model — the package the app used through # v0.1.53 — and so had quietly matched nothing at all. Serializable types today live in # data.model, data and update; keying off @Serializable means moving one never breaks it. -keepattributes *Annotation*, InnerClasses, Signature, RuntimeVisibleAnnotations, AnnotationDefault -dontnote kotlinx.serialization.** -keep @kotlinx.serialization.Serializable class com.ponzischeme89.memby.** { *; } -keepclassmembers class com.ponzischeme89.memby.** { *** Companion; } -keepclasseswithmembers class com.ponzischeme89.memby.** { kotlinx.serialization.KSerializer serializer(...); } -keepclassmembers class **$$serializer { *; } -keep,includedescriptorclasses class com.ponzischeme89.memby.**$$serializer { *; } # --- Retrofit ------------------------------------------------------------------------ # The API interfaces are consumed reflectively; their generic return types must survive # or Retrofit cannot work out what to deserialize into. -keep,allowobfuscation interface com.ponzischeme89.memby.data.remote.EmbyApi -keep,allowobfuscation interface com.ponzischeme89.memby.data.remote.GatewayApi -keepattributes Exceptions # --- Media3 / coroutines ------------------------------------------------------------- -dontwarn androidx.media3.** -dontwarn kotlinx.coroutines.** # --- Crash readability --------------------------------------------------------------- # Releases are self-hosted with no crash reporter, so a stack trace read off a TV over # adb is the only diagnostic there is. Line numbers cost a little dex size and are worth # it; SourceFile is renamed so it does not leak original paths. -keepattributes SourceFile,LineNumberTable -renamesourcefileattribute SourceFile