Skip to content

Commit c6edabc

Browse files
committed
use the suggested way of signing the apk
1 parent 5e8a470 commit c6edabc

File tree

4 files changed

+18
-26
lines changed

4 files changed

+18
-26
lines changed

.gitignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
*.iml
2+
*.aab
23
.gradle
34
/local.properties
5+
/gradle.properties
46
/.idea/
57
.DS_Store
68
/build
79
/captures
8-
release.keystore
9-
signing.properties
10-
/library/build
10+
keystore.jks
11+
keystore.properties

app/build.gradle

+10-20
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"
@@ -17,7 +21,12 @@ android {
1721
}
1822

1923
signingConfigs {
20-
release
24+
release {
25+
keyAlias keystoreProperties['keyAlias']
26+
keyPassword keystoreProperties['keyPassword']
27+
storeFile file(keystoreProperties['storeFile'])
28+
storePassword keystoreProperties['storePassword']
29+
}
2130
}
2231

2332
buildTypes {
@@ -46,22 +55,3 @@ dependencies {
4655

4756
implementation files('../libs/RootTools.jar')
4857
}
49-
50-
Properties props = new Properties()
51-
def propFile = new File('signing.properties')
52-
if (propFile.canRead()) {
53-
props.load(new FileInputStream(propFile))
54-
55-
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('KEY_ALIAS') && props.containsKey('PASSWORD')) {
56-
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
57-
android.signingConfigs.release.storePassword = props['PASSWORD']
58-
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
59-
android.signingConfigs.release.keyPassword = props['PASSWORD']
60-
} else {
61-
println 'signing.properties found but some entries are missing'
62-
android.buildTypes.release.signingConfig = null
63-
}
64-
} else {
65-
println 'signing.properties not found'
66-
android.buildTypes.release.signingConfig = null
67-
}

keystore.properties_sample

+4
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

-3
This file was deleted.

0 commit comments

Comments
 (0)