Skip to content

Commit e37c0b2

Browse files
committed
🚑 🔐 Signed APK
1 parent 763746f commit e37c0b2

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

android/app/build.gradle

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ apply plugin: 'com.android.application'
2525
apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

28+
// 🔐 For apk signing
29+
def keystoreProperties = new Properties()
30+
def keystorePropertiesFile = rootProject.file('key.properties')
31+
if (keystorePropertiesFile.exists()) {
32+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
33+
}
34+
2835
android {
2936
compileSdkVersion 30
3037

@@ -41,13 +48,19 @@ android {
4148
versionName flutterVersionName
4249
}
4350

44-
buildTypes {
45-
release {
46-
// TODO: Add your own signing config for the release build.
47-
// Signing with the debug keys for now, so `flutter run --release` works.
48-
signingConfig signingConfigs.debug
49-
}
50-
}
51+
signingConfigs {
52+
release {
53+
keyAlias keystoreProperties['keyAlias']
54+
keyPassword keystoreProperties['keyPassword']
55+
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
56+
storePassword keystoreProperties['storePassword']
57+
}
58+
}
59+
buildTypes {
60+
release {
61+
signingConfig signingConfigs.release
62+
}
63+
}
5164
}
5265

5366
flutter {

0 commit comments

Comments
 (0)