From d58d52bd2a76efabc1875c96b3308eb742abef3d Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Wed, 30 Sep 2026 01:28:54 +0000 Subject: [PATCH] build(r8): keep Koin classes whole but let R8 shrink their members (#7472) --- config/proguard/shared-rules.pro | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/config/proguard/shared-rules.pro b/config/proguard/shared-rules.pro index 6d34107ac1..b97acd0708 100644 --- a/config/proguard/shared-rules.pro +++ b/config/proguard/shared-rules.pro @@ -32,12 +32,14 @@ -keep class org.meshtastic.core.resources.Res { *; } -keepclassmembers class org.meshtastic.core.resources.Res$* { *; } -# ---- Koin Annotations (KSP-generated DI graph) ------------------------------ --keep @org.koin.core.annotation.Module class * { *; } --keep @org.koin.core.annotation.ComponentScan class * { *; } --keep @org.koin.core.annotation.Single class * { *; } --keep @org.koin.core.annotation.Factory class * { *; } --keep @org.koin.core.annotation.KoinViewModel class * { *; } +# ---- Koin Annotations ------------------------------------------------------- +# R8 must not merge a Koin-annotated class: the registration's const-class is +# its Koin key. Members may still shrink. +-keep,allowshrinking @org.koin.core.annotation.Module class * +-keep,allowshrinking @org.koin.core.annotation.ComponentScan class * +-keep,allowshrinking @org.koin.core.annotation.Single class * +-keep,allowshrinking @org.koin.core.annotation.Factory class * +-keep,allowshrinking @org.koin.core.annotation.KoinViewModel class * # ---- kotlinx.coroutines (inlined from coroutines.pro consumer rules) -------- -keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}