R8 obfuscates androidx.security.crypto + com.google.crypto.tink, which resolve primitives via reflection. Only -dontwarn existed, so release builds silently read an empty token: every API call 401'd and the app showed 'Session expired' (debug builds were unaffected — no minification). Verified on device: release APK before → 401 on WS ticket mint; after → existing token read and session connects with no re-login. Co-authored-by: M57 <hy4ri@users.noreply.github.com>
60 lines
3.5 KiB
Prolog
60 lines
3.5 KiB
Prolog
# ── Kotlin / Coroutines ─────────────────────────────────────────────────
|
|
-dontwarn kotlinx.coroutines.**
|
|
|
|
|
|
# ── Room ─────────────────────────────────────────────────────────────────
|
|
-keep class * extends androidx.room.RoomDatabase { *; }
|
|
-keep @androidx.room.Entity class * { *; }
|
|
-keepclassmembers class * { @androidx.room.* <methods>; }
|
|
-dontwarn androidx.room.**
|
|
|
|
# ── Gson / Serialization ─────────────────────────────────────────────────
|
|
# Keep all data model classes — Gson uses reflection to access fields
|
|
-keep class com.m57.hermescontrol.data.model.** { *; }
|
|
-keep class com.m57.hermescontrol.data.ws.JsonRpc* { *; }
|
|
-keep class com.m57.hermescontrol.data.ws.WsEvent* { *; }
|
|
-keep class com.m57.hermescontrol.data.ws.WsMethods { *; }
|
|
-keep class com.m57.hermescontrol.ui.chat.ChatMessage { *; }
|
|
-keep class com.m57.hermescontrol.ui.chat.MessageRole { *; }
|
|
-keep class com.m57.hermescontrol.ui.chat.ToolStatus { *; }
|
|
|
|
# Generic type signatures used by serialization
|
|
-keepattributes Signature
|
|
-keepattributes *Annotation*
|
|
-keepattributes EnclosingMethod
|
|
-keepattributes InnerClasses
|
|
|
|
# ── OkHttp / Retrofit ────────────────────────────────────────────────────
|
|
-dontwarn okhttp3.**
|
|
-dontwarn okio.**
|
|
-dontwarn retrofit2.**
|
|
-keepattributes RuntimeVisibleAnnotations
|
|
-keepattributes RuntimeInvisibleAnnotations
|
|
-keepclassmembers,allowshrinking,allowobfuscation interface * {
|
|
@retrofit2.http.* <methods>;
|
|
}
|
|
|
|
# ── AndroidX Security Crypto ─────────────────────────────────────────────
|
|
# EncryptedSharedPreferences / MasterKey resolve primitives via Tink's
|
|
# reflection-based Registry. Without -keep, R8 obfuscates those classes and
|
|
# token reads silently fail (401 on every API call, "Session expired").
|
|
-keep class androidx.security.crypto.** { *; }
|
|
-keep class com.google.crypto.tink.** { *; }
|
|
-dontwarn androidx.security.crypto.**
|
|
|
|
# ── Tink / Error Prone ───────────────────────────────────────────────────
|
|
# Tink references com.google.errorprone.annotations.Immutable which isn't
|
|
# shipped as a runtime dependency. Suppress the R8 missing-class error.
|
|
-dontwarn com.google.errorprone.annotations.Immutable
|
|
|
|
# ── Compose ───────────────────────────────────────────────────────────────
|
|
-dontwarn androidx.compose.**
|
|
|
|
# ── BuildConfig ───────────────────────────────────────────────────────────
|
|
-keep class com.m57.hermescontrol.BuildConfig { *; }
|
|
|
|
# ── Navigation (NavKey Names) ─────────────────────────────────────────────
|
|
# Keep screen object class names because their simpleNames are used for bottom nav selection and storage.
|
|
-keep class * extends androidx.navigation3.runtime.NavKey { *; }
|
|
|