Refine ProGuard rules: add crash reporting attributes, tighten Room/serialization keeps, preserve enums and framework classes
Build and Release APK / build-and-release (push) Has been cancelled
Build and Release APK / build-and-release (push) Has been cancelled
This commit is contained in:
Vendored
+26
-18
@@ -1,31 +1,39 @@
|
||||
# ProGuard rules for ESP32 ALDL Dashboard
|
||||
# Compose + Room + Kotlin Serialization + Navigation3
|
||||
|
||||
# --- General ---
|
||||
# --- Crash stack traces: preserve file names and line numbers ---
|
||||
-keepattributes SourceFile,LineNumberTable
|
||||
-renamesourcefileattribute SourceFile
|
||||
|
||||
# --- General reflection / generic type preservation ---
|
||||
-keepattributes *Annotation*
|
||||
-keepattributes Signature
|
||||
-keepattributes InnerClasses
|
||||
-keepattributes EnclosingMethod
|
||||
|
||||
# --- Room ---
|
||||
-keep class * extends androidx.room.RoomDatabase
|
||||
-keep class * { @androidx.room.* <fields>; }
|
||||
-dontwarn androidx.room.paging.**
|
||||
# RoomDatabase subclass is instantiated by reflection
|
||||
-keep class * extends androidx.room.RoomDatabase { *; }
|
||||
# Keep all @Entity, @Dao, @Database annotated members
|
||||
-keep @androidx.room.Entity class * { *; }
|
||||
-keep @androidx.room.Dao interface * { *; }
|
||||
-keep @androidx.room.Database class * { *; }
|
||||
|
||||
# --- Kotlin Serialization ---
|
||||
-keep class kotlinx.serialization.** { *; }
|
||||
-keepclassmembers class ** {
|
||||
static ** \]serializerInstance;
|
||||
# Only nav key objects annotated with @Serializable need explicit protection;
|
||||
# the Kotlin compiler plugin generates keep rules for everything else.
|
||||
-keep @kotlinx.serialization.Serializable class com.gronod.esp32aldldashboard.** { *; }
|
||||
|
||||
# --- Enums ---
|
||||
# Preserve enum names used by Room, Bluetooth state, and conditional logic
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
# --- Compose / Navigation3 ---
|
||||
-keep class androidx.navigation3.** { *; }
|
||||
-keepclassmembers class * {
|
||||
@androidx.compose.runtime.Composable <methods>;
|
||||
}
|
||||
|
||||
# --- DataStore ---
|
||||
-keep class androidx.datastore.** { *; }
|
||||
|
||||
# --- Keep all app classes (safe for now) ---
|
||||
-keep class com.gronod.esp32aldldashboard.** { *; }
|
||||
# --- Application, Service, ViewModel, and Factory ---
|
||||
# These are instantiated by the Android framework or ViewModelProvider via reflection
|
||||
-keep class com.gronod.esp32aldldashboard.AldlApplication { *; }
|
||||
-keep class com.gronod.esp32aldldashboard.bluetooth.BluetoothForegroundService { *; }
|
||||
-keep class * extends androidx.lifecycle.ViewModel { *; }
|
||||
-keep class * extends androidx.lifecycle.ViewModelProvider$Factory { *; }
|
||||
Reference in New Issue
Block a user