Skip to content

Commit 90f1f48

Browse files
committed
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
1 parent e2bce09 commit 90f1f48

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

β€Žandroid/app/proguard-rules.proβ€Ž

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,25 @@
5959
-keep class * implements com.google.gson.JsonSerializer
6060
-keep class * implements com.google.gson.JsonDeserializer
6161

62-
# Keep your app's data classes
63-
-keep class dev.dettmer.simplenotes.** { *; }
62+
# ═══════════════════════════════════════════════════════════════════════
63+
# App-specific rules: Only keep what Gson/reflection needs
64+
# ═══════════════════════════════════════════════════════════════════════
65+
66+
# Gson data models (serialized/deserialized via reflection)
67+
-keep class dev.dettmer.simplenotes.models.Note { *; }
68+
-keep class dev.dettmer.simplenotes.models.Note$NoteRaw { *; }
69+
-keep class dev.dettmer.simplenotes.models.ChecklistItem { *; }
70+
-keep class dev.dettmer.simplenotes.models.DeletionRecord { *; }
71+
-keep class dev.dettmer.simplenotes.models.DeletionTracker { *; }
72+
-keep class dev.dettmer.simplenotes.backup.BackupData { *; }
73+
-keep class dev.dettmer.simplenotes.backup.BackupResult { *; }
74+
75+
# Keep enum values (used in serialization and widget state)
76+
-keepclassmembers enum dev.dettmer.simplenotes.** {
77+
<fields>;
78+
public static **[] values();
79+
public static ** valueOf(java.lang.String);
80+
}
6481

6582
# v1.7.1: Suppress TextInclusionStrategy warnings on older Android versions
6683
# This class only exists on API 35+ but Compose handles the fallback gracefully

0 commit comments

Comments
Β (0)