Skip to content

Commit 39faefd

Browse files
committed
add a Release keystore
1 parent 1909217 commit 39faefd

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

app/build.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ android {
1212
versionCode 1
1313
versionName "1.0"
1414
}
15+
16+
signingConfigs {
17+
release
18+
}
19+
1520
buildTypes {
1621
release {
1722
minifyEnabled false
1823
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24+
signingConfig signingConfigs.release
1925
}
2026
}
2127
}
@@ -29,3 +35,23 @@ dependencies {
2935

3036
apt 'com.jakewharton:butterknife-compiler:8.0.1'
3137
}
38+
39+
def Properties props = new Properties()
40+
def propFile = new File('signing.properties')
41+
if (propFile.canRead()) {
42+
props.load(new FileInputStream(propFile))
43+
44+
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
45+
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
46+
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
47+
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
48+
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
49+
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
50+
} else {
51+
println 'signing.properties found but some entries are missing'
52+
android.buildTypes.release.signingConfig = null
53+
}
54+
} else {
55+
println 'signing.properties not found'
56+
android.buildTypes.release.signingConfig = null
57+
}

signing.properties_sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
STORE_FILE=/path/to/your.keystore
2+
STORE_PASSWORD=yourkeypass
3+
KEY_ALIAS=projectkeyalias
4+
KEY_PASSWORD=yourkeypass

0 commit comments

Comments
 (0)