2026-04-13 12:11:42 -05:00
|
|
|
# ============================================================================
|
|
|
|
|
# Meshtastic Android — ProGuard / R8 rules for release minification
|
|
|
|
|
# ============================================================================
|
2026-04-15 12:45:27 -05:00
|
|
|
# Open-source project: obfuscation and optimization are disabled. We rely on
|
|
|
|
|
# tree-shaking (unused code removal) for APK size reduction.
|
2026-04-13 12:11:42 -05:00
|
|
|
# ============================================================================
|
|
|
|
|
|
|
|
|
|
# ---- General ----------------------------------------------------------------
|
2020-01-20 15:53:22 -08:00
|
|
|
|
2026-04-15 12:45:27 -05:00
|
|
|
# Preserve line numbers for meaningful crash traces
|
2026-04-13 12:11:42 -05:00
|
|
|
-keepattributes SourceFile,LineNumberTable
|
2020-04-04 14:37:44 -07:00
|
|
|
|
2026-04-13 12:11:42 -05:00
|
|
|
# Open-source — no need to obfuscate
|
|
|
|
|
-dontobfuscate
|
2026-03-22 00:42:27 -05:00
|
|
|
|
2026-04-15 12:45:27 -05:00
|
|
|
# Disable R8 optimization passes. Tree-shaking (unused code removal) still
|
|
|
|
|
# runs — only method-body rewrites and call-site transformations are suppressed.
|
|
|
|
|
#
|
|
|
|
|
# Why: CMP 1.11 ships consumer rules with -assumenosideeffects on
|
|
|
|
|
# Composer.<clinit>() and ComposerImpl.<clinit>(), plus -assumevalues on
|
|
|
|
|
# ComposeRuntimeFlags and ComposeStackTraceMode. These optimization directives
|
|
|
|
|
# let R8 rewrite *call sites* (class-init triggers, flag reads) even when the
|
|
|
|
|
# target classes are preserved by -keep rules. The result is that the Compose
|
|
|
|
|
# recomposer/frame-clock/animation state machines silently freeze on their
|
|
|
|
|
# first frame in release builds. -dontoptimize is the only directive that
|
|
|
|
|
# disables processing of -assumenosideeffects/-assumevalues. See #5146.
|
|
|
|
|
-dontoptimize
|
|
|
|
|
|
2026-04-14 22:26:39 -05:00
|
|
|
# Dump the full merged R8 configuration (app rules + all library consumer rules)
|
|
|
|
|
# for auditing. Inspect this file after a release build to see what libraries inject.
|
|
|
|
|
-printconfiguration build/outputs/mapping/r8-merged-config.txt
|
|
|
|
|
|
2026-04-13 12:11:42 -05:00
|
|
|
# ---- Networking (transitive references from Ktor) ---------------------------
|
2024-05-19 08:29:14 -03:00
|
|
|
|
2023-02-13 18:32:35 -03:00
|
|
|
-dontwarn org.conscrypt.**
|
|
|
|
|
-dontwarn org.bouncycastle.**
|
|
|
|
|
-dontwarn org.openjsse.**
|
|
|
|
|
|
2026-04-13 12:11:42 -05:00
|
|
|
# ---- Wire Protobuf ----------------------------------------------------------
|
2023-02-13 18:32:35 -03:00
|
|
|
|
2026-04-13 12:11:42 -05:00
|
|
|
# Wire-generated proto message classes (accessed via ADAPTER companion reflection)
|
|
|
|
|
-keep class org.meshtastic.proto.** { *; }
|
|
|
|
|
|
|
|
|
|
# ---- Room KMP (room3) ------------------------------------------------------
|
2026-01-25 11:07:07 -06:00
|
|
|
|
2026-04-13 12:11:42 -05:00
|
|
|
# Preserve generated database constructors (Room uses reflection to instantiate)
|
|
|
|
|
-keep class * extends androidx.room3.RoomDatabase { <init>(); }
|
|
|
|
|
|
|
|
|
|
# ---- Koin DI ----------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Prevent R8 from merging exception classes (observed as io.ktor.http.URLDecodeException
|
2026-04-09 22:24:03 -05:00
|
|
|
# replacing Koin's InstanceCreationException in stack traces, making crashes undiagnosable).
|
|
|
|
|
-keep class org.koin.core.error.** { *; }
|
|
|
|
|
|
2026-04-15 09:30:33 -05:00
|
|
|
# ---- Compose Runtime & Animation --------------------------------------------
|
|
|
|
|
|
2026-04-15 12:45:27 -05:00
|
|
|
# Defence-in-depth: prevent R8 tree-shaking of Compose infrastructure classes
|
|
|
|
|
# that are referenced indirectly through compiler-generated state machines.
|
|
|
|
|
# With -dontoptimize above these are largely redundant, but they provide a
|
|
|
|
|
# safety net against future toolchain changes.
|
2026-04-15 09:30:33 -05:00
|
|
|
-keep class androidx.compose.runtime.** { *; }
|
|
|
|
|
-keep class androidx.compose.ui.** { *; }
|
|
|
|
|
-keep class androidx.compose.animation.core.** { *; }
|
|
|
|
|
-keep class androidx.compose.animation.** { *; }
|
2026-04-15 12:45:27 -05:00
|
|
|
-keep class androidx.compose.foundation.** { *; }
|
|
|
|
|
-keep class androidx.compose.material3.** { *; }
|
2026-04-15 09:30:33 -05:00
|
|
|
|
2026-04-13 12:11:42 -05:00
|
|
|
# ---- Compose Multiplatform --------------------------------------------------
|
2026-02-21 18:28:50 -06:00
|
|
|
|
2026-04-13 12:11:42 -05:00
|
|
|
# Keep resource library internals and generated Res accessor classes so R8 does
|
|
|
|
|
# not tree-shake the resource loading infrastructure. Without these rules the
|
|
|
|
|
# fdroid flavor crashes at startup with a misleading URLDecodeException due to
|
|
|
|
|
# R8 exception-class merging.
|
2026-04-10 10:18:02 -05:00
|
|
|
-keep class org.jetbrains.compose.resources.** { *; }
|
|
|
|
|
-keep class org.meshtastic.core.resources.** { *; }
|