@tduncan / Cortana / commits / e0304c0

feat: configure release signing and enable R8 shrinking in Android build gradle

abdulmominsakib committed Apr 1, 2026 at 13:28 UTC e0304c049b979bd486966e33c2356785270f6150
2 files changed +26 -3
.gitignore
+2 -1
@@ -45,4 +45,5 @@ app.*.map.json
45 /android/app/release
46
47 # FVM Version Cache
48 -.fvm/
\ No newline at end of file
48 +.fvm/
49 +playstore_keys
\ No newline at end of file
android/app/build.gradle.kts
+24 -2
@@ -1,3 +1,6 @@
1 +import java.util.Properties
2 +import java.io.FileInputStream
3 +
4 plugins {
5 id("com.android.application")
6 id("kotlin-android")
@@ -5,6 +8,12 @@ plugins {
8 id("dev.flutter.flutter-gradle-plugin")
9 }
10
11 +val keystoreProperties = Properties()
12 +val keystorePropertiesFile = rootProject.file("key.properties")
13 +if (keystorePropertiesFile.exists()) {
14 + keystoreProperties.load(FileInputStream(keystorePropertiesFile))
15 +}
16 +
17 android {
18 namespace = "pro.momin.localmind"
19 compileSdk = flutter.compileSdkVersion
@@ -30,11 +39,24 @@ android {
39 versionName = flutter.versionName
40 }
41
33 - buildTypes {
42 + signingConfigs {
43 + create("release") {
44 + keyAlias = keystoreProperties["keyAlias"] as String
45 + keyPassword = keystoreProperties["keyPassword"] as String
46 + storeFile = keystoreProperties["storeFile"]?.let { file(it) }
47 + storePassword = keystoreProperties["storePassword"] as String
48 + }
49 + }
50 +
51 +
52 + buildTypes {
53 release {
54 // TODO: Add your own signing config for the release build.
55 // Signing with the debug keys for now, so `flutter run --release` works.
37 - signingConfig = signingConfigs.getByName("debug")
56 + signingConfig = signingConfigs.getByName("release")
57 + // Enable code shrinking, obfuscation, and resource shrinking for release builds to reduce app size
58 + isMinifyEnabled = true
59 + isShrinkResources = true
60 }
61 }
62 }