Skip to content

Commit d57444f

Browse files
committed
refresh the way apps are signed
1 parent dd47deb commit d57444f

File tree

4 files changed

+15
-24
lines changed

4 files changed

+15
-24
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
/build
99
/captures
1010
keystore.jks
11-
signing.properties
11+
keystore.properties

app/build.gradle

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

5+
def keystorePropertiesFile = rootProject.file("keystore.properties")
6+
def keystoreProperties = new Properties()
7+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
8+
59
android {
610
compileSdkVersion 28
711
buildToolsVersion "28.0.3"
@@ -16,7 +20,12 @@ android {
1620
}
1721

1822
signingConfigs {
19-
release
23+
release {
24+
keyAlias keystoreProperties['keyAlias']
25+
keyPassword keystoreProperties['keyPassword']
26+
storeFile file(keystoreProperties['storeFile'])
27+
storePassword keystoreProperties['storePassword']
28+
}
2029
}
2130

2231
buildTypes {
@@ -43,22 +52,3 @@ android {
4352
dependencies {
4453
implementation 'com.simplemobiletools:commons:5.3.8'
4554
}
46-
47-
Properties props = new Properties()
48-
def propFile = new File('signing.properties')
49-
if (propFile.canRead()) {
50-
props.load(new FileInputStream(propFile))
51-
52-
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('KEY_ALIAS') && props.containsKey('PASSWORD')) {
53-
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
54-
android.signingConfigs.release.storePassword = props['PASSWORD']
55-
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
56-
android.signingConfigs.release.keyPassword = props['PASSWORD']
57-
} else {
58-
println 'signing.properties found but some entries are missing'
59-
android.buildTypes.release.signingConfig = null
60-
}
61-
} else {
62-
println 'signing.properties not found'
63-
android.buildTypes.release.signingConfig = null
64-
}

keystore.properties_sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
storePassword=123456
2+
keyPassword=abcdef
3+
keyAlias=myAlias
4+
storeFile=../keystore.jks

signing.properties_sample

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)