Skip to content

Commit c870426

Browse files
build: Upgrade Gradle to 9.2.1 and overhaul R8 optimizations
- Upgrade Gradle Wrapper to `9.2.1` and update accompanying shell scripts. - Enable R8 full mode and optimized resource shrinking in `gradle.properties`. - Rewrite `proguard-rules.pro` to apply aggressive optimizations, strip `android.util.Log` calls, and remove Kotlin intrinsic null checks. - Update dependencies: `composeBom` to `2025.12.00`, `material3` to `1.5.0-alpha10`, `activityCompose` to `1.12.1`, and `kotlinxSerialization` to `3.3.3`. - Remove deprecated `release.sh` and `release-notes.md` files. - Update application assets, including launcher icons and mascot images.
1 parent 154dc02 commit c870426

21 files changed

Lines changed: 274 additions & 241 deletions

app/proguard-rules.pro

Lines changed: 65 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,82 @@
1-
# ProGuard/R8 rules for Multiply app
2-
# Build uses: Jetpack Compose, Hilt (Dagger), Kotlin coroutines, DataStore Preferences,
3-
# Navigation-Compose, and kotlinx.serialization (plugin applied, conservative keep below).
4-
# Release build is minified and shrinks resources.
1+
# ProGuard/R8 rules for Multiply app - Maximum APK size reduction
2+
# CRITICAL: Also add to gradle.properties:
53

6-
# ----- General Kotlin/Android keeps -----
7-
# Keep important class attributes used by Kotlin, generics, and DI generated code
8-
-keepattributes *Annotation*, InnerClasses, EnclosingMethod, Signature
4+
# ----- Extreme optimization settings -----
5+
-allowaccessmodification
6+
-repackageclasses ''
7+
-overloadaggressively
8+
-mergeinterfacesaggressively
99

10-
# Keep enum valueOf()/values() methods (defensive; sometimes used reflectively)
11-
-keepclassmembers enum * {
10+
# ----- Minimal attribute preservation -----
11+
-keepattributes Signature,RuntimeVisible*Annotations
12+
# Uncomment for crash reports (adds ~1-2KB):
13+
# -keepattributes SourceFile,LineNumberTable
14+
# -renamesourcefileattribute SourceFile
15+
16+
# ----- Enum optimization -----
17+
# Only keep enum methods if actually used reflectively
18+
-keepclassmembers,allowoptimization enum * {
1219
public static **[] values();
1320
public static ** valueOf(java.lang.String);
1421
}
1522

16-
# ----- Android components -----
17-
# These are kept automatically by default rules via manifest, but we keep names defensively
18-
-keep class com.stephenwanjala.multiply.MultiplyApp
19-
-keep class com.stephenwanjala.multiply.MainActivity
23+
# ----- Android components (allow obfuscation) -----
24+
-keep,allowobfuscation,allowshrinking class com.stephenwanjala.multiply.MultiplyApp
25+
-keep,allowobfuscation,allowshrinking class com.stephenwanjala.multiply.MainActivity
2026

2127
# ----- Dagger/Hilt -----
22-
# Hilt provides its own keep rules; suppress possible warnings from generated/internal types
23-
-dontwarn dagger.hilt.internal.**
24-
-dontwarn dagger.internal.**
28+
# Hilt's consumer rules handle most; suppress warnings to avoid bloat from defensive keeps
29+
-dontwarn dagger.**
2530
-dontwarn javax.inject.**
2631

27-
# ----- Kotlinx Serialization (scoped to Navigation destinations) -----
28-
# We only serialize navigation destinations; keep just those to avoid broad keeps
29-
-keep class com.stephenwanjala.multiply.ui.navigation.MultiplyDestination
30-
-keep class com.stephenwanjala.multiply.ui.navigation.MultiplyDestination$* { *; }
31-
-dontwarn kotlinx.serialization.**
32+
# ----- Kotlinx Serialization (Navigation only) -----
33+
-if @kotlinx.serialization.Serializable class **
34+
-keepclassmembers class <1> {
35+
static <1>$Companion Companion;
36+
}
37+
-if @kotlinx.serialization.Serializable class ** {
38+
static **$* *;
39+
}
40+
-keepclassmembers class <1>$<3> {
41+
kotlinx.serialization.KSerializer serializer(...);
42+
}
43+
-keep,includedescriptorclasses class com.stephenwanjala.multiply.ui.navigation.**$serializer { *; }
44+
-keepclassmembers class com.stephenwanjala.multiply.ui.navigation.** {
45+
*** Companion;
46+
}
47+
-keepclasseswithmembers class com.stephenwanjala.multiply.ui.navigation.** {
48+
kotlinx.serialization.KSerializer serializer(...);
49+
}
3250

3351
# ----- Jetpack Compose -----
34-
# Compose libraries ship consumer rules; no extra keeps are typically required.
35-
# Suppress potential warnings from generated/inlined code in Compose tooling
52+
# Compose libraries have consumer rules; suppress warnings
3653
-dontwarn androidx.compose.**
3754

38-
## ----- Coroutines / Kotlin stdlib -----
39-
## These are well-supported by R8; silence potential harmless warnings
55+
# ----- Coroutines / Kotlin stdlib -----
4056
-dontwarn kotlinx.coroutines.**
41-
#
42-
## ----- DataStore Preferences -----
57+
-dontwarn kotlin.**
58+
59+
# ----- DataStore Preferences -----
4360
-dontwarn androidx.datastore.**
4461

45-
# ----- Optional: keep line numbers for better crash reports (uncomment if desired) -----
46-
# -keepattributes SourceFile,LineNumberTable
47-
# -renamesourcefileattribute SourceFile
62+
# ----- Remove logging in release -----
63+
# Strip all Log calls to reduce code size (optional but recommended)
64+
-assumenosideeffects class android.util.Log {
65+
public static *** d(...);
66+
public static *** v(...);
67+
public static *** i(...);
68+
public static *** w(...);
69+
public static *** e(...);
70+
}
71+
72+
# ----- Remove runtime null checks (Kotlin) -----
73+
# R8 can remove Kotlin's intrinsic null checks in release builds
74+
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
75+
public static void checkNotNull(...);
76+
public static void checkParameterIsNotNull(...);
77+
public static void checkNotNullParameter(...);
78+
public static void checkExpressionValueIsNotNull(...);
79+
public static void checkNotNullExpressionValue(...);
80+
public static void checkReturnedValueIsNotNull(...);
81+
public static void checkFieldIsNotNull(...);
82+
}

app/release/app-release.apk

-207 KB
Binary file not shown.
2.64 KB
Binary file not shown.
2.74 KB
Binary file not shown.
-102 KB
Loading
-269 KB
Loading
-6.04 KB
Loading
-4.59 KB
Loading
-7.97 KB
Loading
-7.97 KB
Loading

0 commit comments

Comments
 (0)