From c6edabcbe88c309efb50a97e5c1de1fb8e4d45bf Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Nov 2018 00:06:53 +0100 Subject: [PATCH] use the suggested way of signing the apk --- .gitignore | 7 ++++--- app/build.gradle | 30 ++++++++++-------------------- keystore.properties_sample | 4 ++++ signing.properties_sample | 3 --- 4 files changed, 18 insertions(+), 26 deletions(-) create mode 100644 keystore.properties_sample delete mode 100644 signing.properties_sample diff --git a/.gitignore b/.gitignore index 32512494..660f31f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,11 @@ *.iml +*.aab .gradle /local.properties +/gradle.properties /.idea/ .DS_Store /build /captures -release.keystore -signing.properties -/library/build +keystore.jks +keystore.properties diff --git a/app/build.gradle b/app/build.gradle index 4e853be4..44eb079a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,6 +2,10 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' +def keystorePropertiesFile = rootProject.file("keystore.properties") +def keystoreProperties = new Properties() +keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) + android { compileSdkVersion 28 buildToolsVersion "28.0.3" @@ -17,7 +21,12 @@ android { } signingConfigs { - release + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile file(keystoreProperties['storeFile']) + storePassword keystoreProperties['storePassword'] + } } buildTypes { @@ -46,22 +55,3 @@ dependencies { implementation files('../libs/RootTools.jar') } - -Properties props = new Properties() -def propFile = new File('signing.properties') -if (propFile.canRead()) { - props.load(new FileInputStream(propFile)) - - if (props != null && props.containsKey('STORE_FILE') && props.containsKey('KEY_ALIAS') && props.containsKey('PASSWORD')) { - android.signingConfigs.release.storeFile = file(props['STORE_FILE']) - android.signingConfigs.release.storePassword = props['PASSWORD'] - android.signingConfigs.release.keyAlias = props['KEY_ALIAS'] - android.signingConfigs.release.keyPassword = props['PASSWORD'] - } else { - println 'signing.properties found but some entries are missing' - android.buildTypes.release.signingConfig = null - } -} else { - println 'signing.properties not found' - android.buildTypes.release.signingConfig = null -} diff --git a/keystore.properties_sample b/keystore.properties_sample new file mode 100644 index 00000000..569edd73 --- /dev/null +++ b/keystore.properties_sample @@ -0,0 +1,4 @@ +storePassword=123456 +keyPassword=abcdef +keyAlias=myAlias +storeFile=../keystore.jks diff --git a/signing.properties_sample b/signing.properties_sample deleted file mode 100644 index 6b9a3446..00000000 --- a/signing.properties_sample +++ /dev/null @@ -1,3 +0,0 @@ -STORE_FILE=/path/to/your.keystore -KEY_ALIAS=projectkeyalias -PASSWORD=yourkeypass