perf(v1.8.0): optimize ProGuard/R8 rules for smaller APK size

- Replace broad '-keep class dev.dettmer.simplenotes.** { *; }' with targeted rules
- Keep only Gson data models and enum values that require reflection
- Allow R8 to shrink/obfuscate remaining app code
- Update rules for: Note, ChecklistItem, DeletionTracker, BackupData models
- Keep enum values() and valueOf() for state serialization
- Remove unnecessary keep rules for non-reflection classes
- Add structured comments for maintainability

APK size reduced from 5.0 MB → 4.8 MB (200 KB saved).
R8 now has better optimization opportunities while maintaining functionality.
All unit tests pass, lint reports clean (0 errors, 0 warnings).

Build: BUILD SUCCESSFUL - 4.8M app-fdroid-release.apk
This commit is contained in:
inventory69
2026-02-10 17:01:01 +01:00
parent e2bce099f3
commit 90f1f48810

View File

@@ -59,8 +59,25 @@
-keep class * implements com.google.gson.JsonSerializer -keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer -keep class * implements com.google.gson.JsonDeserializer
# Keep your app's data classes # ═══════════════════════════════════════════════════════════════════════
-keep class dev.dettmer.simplenotes.** { *; } # App-specific rules: Only keep what Gson/reflection needs
# ═══════════════════════════════════════════════════════════════════════
# Gson data models (serialized/deserialized via reflection)
-keep class dev.dettmer.simplenotes.models.Note { *; }
-keep class dev.dettmer.simplenotes.models.Note$NoteRaw { *; }
-keep class dev.dettmer.simplenotes.models.ChecklistItem { *; }
-keep class dev.dettmer.simplenotes.models.DeletionRecord { *; }
-keep class dev.dettmer.simplenotes.models.DeletionTracker { *; }
-keep class dev.dettmer.simplenotes.backup.BackupData { *; }
-keep class dev.dettmer.simplenotes.backup.BackupResult { *; }
# Keep enum values (used in serialization and widget state)
-keepclassmembers enum dev.dettmer.simplenotes.** {
<fields>;
public static **[] values();
public static ** valueOf(java.lang.String);
}
# v1.7.1: Suppress TextInclusionStrategy warnings on older Android versions # v1.7.1: Suppress TextInclusionStrategy warnings on older Android versions
# This class only exists on API 35+ but Compose handles the fallback gracefully # This class only exists on API 35+ but Compose handles the fallback gracefully