refresh the way release apks are signed

This commit is contained in:
tibbi 2018-11-06 22:28:17 +01:00
parent 9f01cb5389
commit f14d197830
4 changed files with 19 additions and 27 deletions

7
.gitignore vendored
View File

@ -1,10 +1,11 @@
*.iml *.iml
*.aab
.gradle .gradle
/local.properties /local.properties
/gradle.properties
/.idea/ /.idea/
.DS_Store .DS_Store
/build /build
/captures /captures
release.keystore keystore.jks
signing.properties keystore.properties
/library/build

View File

@ -3,6 +3,10 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android { android {
compileSdkVersion 28 compileSdkVersion 28
buildToolsVersion "28.0.3" buildToolsVersion "28.0.3"
@ -17,7 +21,12 @@ android {
} }
signingConfigs { signingConfigs {
release release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
} }
buildTypes { buildTypes {
@ -42,7 +51,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.3.11' implementation 'com.simplemobiletools:commons:5.3.12'
implementation 'joda-time:joda-time:2.9.9' implementation 'joda-time:joda-time:2.9.9'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.4' implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.4'
@ -51,22 +60,3 @@ dependencies {
implementation "androidx.room:room-runtime:2.0.0" implementation "androidx.room:room-runtime:2.0.0"
annotationProcessor "androidx.room:room-compiler:2.0.0" annotationProcessor "androidx.room:room-compiler:2.0.0"
} }
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
}

View File

@ -0,0 +1,4 @@
storePassword=123456
keyPassword=abcdef
keyAlias=myAlias
storeFile=../keystore.jks

View File

@ -1,3 +0,0 @@
STORE_FILE=/path/to/your.keystore
KEY_ALIAS=projectkeyalias
PASSWORD=yourpass