Skip to content

Commit 3059f80

Browse files
committed
Configure android gradle release build type
1 parent 9880eeb commit 3059f80

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

android/app/build.gradle.kts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
import java.util.Properties
2+
import java.io.FileInputStream
3+
14
plugins {
25
id("com.android.application")
36
id("kotlin-android")
47
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
58
id("dev.flutter.flutter-gradle-plugin")
69
}
710

11+
val keystorePropertiesFile = rootProject.file("key.properties")
12+
val keystoreProperties = Properties().apply {
13+
if (keystorePropertiesFile.exists()) {
14+
load(FileInputStream(keystorePropertiesFile))
15+
}
16+
}
17+
818
android {
919
namespace = "dev.shtanko.flutter_bloc_app_template"
1020
compileSdk = flutter.compileSdkVersion
@@ -59,11 +69,27 @@ android {
5969
}
6070
}
6171

72+
signingConfigs {
73+
register("release") {
74+
enableV1Signing = true
75+
enableV2Signing = true
76+
77+
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
78+
storePassword = keystoreProperties["storePassword"] as String?
79+
keyAlias = keystoreProperties["keyAlias"] as String?
80+
keyPassword = keystoreProperties["keyPassword"] as String?
81+
}
82+
}
83+
6284
buildTypes {
6385
release {
64-
// TODO: Add your own signing config for the release build.
65-
// Signing with the debug keys for now, so `flutter run --release` works.
66-
signingConfig = signingConfigs.getByName("debug")
86+
isMinifyEnabled = true
87+
isShrinkResources = true
88+
proguardFiles(
89+
getDefaultProguardFile("proguard-android-optimize.txt"),
90+
"proguard-rules.pro"
91+
)
92+
signingConfig = signingConfigs.getByName("release")
6793
}
6894
}
6995
}

0 commit comments

Comments
 (0)