1 # ProGuard rules for the Onde Chat example app (release build).
2 #
3 # The Onde SDK AAR ships its own consumer-rules.pro that preserves all UniFFI
4 # JNI bridge symbols automatically — no SDK-specific rules are needed here.
5 #
6 # These rules cover the example app itself and common Android/Kotlin patterns.
7
8 # ── Kotlin ────────────────────────────────────────────────────────────────────
9
10 # Keep Kotlin metadata so reflection and serialisation work correctly at runtime.
11 -keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod
12
13 # Kotlin coroutines — keep internal machinery used by the coroutine debugger
14 # and exception handling paths.
15 -keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
16 -keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
17 -keepclassmembernames class kotlinx.coroutines.** {
18 volatile <fields>;
19 }
20
21 # ── Jetpack Compose ───────────────────────────────────────────────────────────
22
23 # Compose relies heavily on reflection for @Composable slot-table lookups.
24 # The compose-bom ships its own rules but this ensures nothing is stripped
25 # during incremental R8 optimisation passes.
26 -keepclassmembers class * {
27 @androidx.compose.runtime.Composable <methods>;
28 }
29
30 # ── AndroidX ──────────────────────────────────────────────────────────────────
31
32 # ViewModel — keep all subclasses so the ViewModelProvider can instantiate them.
33 -keep public class * extends androidx.lifecycle.ViewModel {
34 public <init>(...);
35 }
36
37 # ── General Android ───────────────────────────────────────────────────────────
38
39 # Preserve classes that implement Parcelable so the OS can reconstruct them
40 # across process boundaries (e.g. saved instance state).
41 -keep class * implements android.os.Parcelable {
42 public static final android.os.Parcelable$Creator *;
43 }
44
45 # Keep enum members used in switch expressions generated by kotlinc.
46 -keepclassmembers enum * {
47 public static **[] values();
48 public static ** valueOf(java.lang.String);
49 }
50
51 # Remove verbose logging in release builds to reduce APK size and avoid
52 # leaking internal state to logcat on production devices.
53 -assumenosideeffects class android.util.Log {
54 public static int v(...);
55 public static int d(...);
56 }