Skip to content

Commit 941b893

Browse files
committed
fix non-signed builds
1 parent 7b116f9 commit 941b893

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

android/app/build.gradle

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ def enableSeparateBuildPerCPUArchitecture = false
9797
*/
9898
def enableProguardInReleaseBuilds = false
9999

100+
/**
101+
* Fetch the keystore file's path from the environment
102+
*/
103+
String keystorePath = System.getenv("KEYSTORE_FILE")
104+
100105
android {
101106
compileSdkVersion rootProject.ext.compileSdkVersion
102107

@@ -123,19 +128,17 @@ android {
123128

124129
signingConfigs {
125130
// originally derived from https://gist.github.com/gabrielemariotti/6856974
126-
String filePath = System.getenv("KEYSTORE_FILE")
127-
128-
if (filePath == null) {
131+
if (keystorePath == null) {
129132
logger.warn "env['KEYSTORE_FILE'] not set"
130133
release
131134
return
132135
} else {
133-
logger.warn "env['KEYSTORE_FILE'] = ${filePath}"
136+
logger.warn "env['KEYSTORE_FILE'] = ${keystorePath}"
134137
}
135138

136-
def propFile = new File(filePath)
139+
def propFile = new File(keystorePath)
137140
if (!propFile.canRead()) {
138-
logger.warn "${filePath} is not readable"
141+
logger.warn "${keystorePath} is not readable"
139142
release
140143
return
141144
}
@@ -170,7 +173,9 @@ android {
170173

171174
minifyEnabled enableProguardInReleaseBuilds
172175
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
173-
signingConfig signingConfigs.release
176+
if (keystorePath != null) {
177+
signingConfig signingConfigs.release
178+
}
174179
}
175180
}
176181

0 commit comments

Comments
 (0)