android release signing

This commit is contained in:
Thibault Deckers 2020-06-12 22:58:29 +09:00
parent 043fe51379
commit 6abd3f800a
2 changed files with 17 additions and 3 deletions

1
.gitignore vendored
View file

@ -35,3 +35,4 @@ lib/generated_plugin_registrant.dart
# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
android/key.properties

View file

@ -24,6 +24,12 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 29 // latest (or latest-1 if the sources of latest SDK are unavailable)
@ -50,14 +56,21 @@ android {
// targetCompatibility JavaVersion.VERSION_1_8
// }
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}