Skip to content

Commit 55c1aa1

Browse files
committed
Add signing config to gradle
This way I (and anyone) can align and sign the release builds by just excecuting ```./gradlew assembleRelease```, which will save me time and allow me to upload an signed apk with each version.
1 parent 747da74 commit 55c1aa1

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
*~
2+
*#
3+
keystore.properties
4+
app/keystore.ks
5+
app/build.gradle
6+
7+
18
# Created by https://www.gitignore.io
29

310
### Android ###

app/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ ext {
55
apply plugin: 'com.android.application'
66
apply plugin: 'kotlin-android'
77

8+
9+
if(rootProject.file("keystore.properties").exists()) {
10+
// From https://developer.android.com/studio/publish/app-signing.html
11+
// to load the signing config file
12+
def keystorePropertiesFile = rootProject.file("keystore.properties")
13+
def keystoreProperties = new Properties()
14+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
15+
16+
android {
17+
signingConfigs {
18+
release {
19+
keyAlias keystoreProperties['keyAlias']
20+
keyPassword keystoreProperties['keyPassword']
21+
storeFile file(keystoreProperties['storeFile'])
22+
storePassword keystoreProperties['storePassword']
23+
}
24+
}
25+
buildTypes {
26+
release {
27+
signingConfig signingConfigs.release
28+
}
29+
}
30+
}
31+
}
32+
833
android {
934
compileSdkVersion 25
1035
buildToolsVersion "25.0.2"

0 commit comments

Comments
 (0)