Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Use file which controls which keystore to use to sign the APK with gradle.
android {
signingConfigs {
buildTypes {
release {
signingConfig signingConfigs.release
def Properties props = new Properties()
def propFile = new File('')
if (propFile.canRead()){
props.load(new FileInputStream(propFile))
if (props!=null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
println ' found but some entries are missing'
android.buildTypes.release.signingConfig = null
}else {
println ' not found'
android.buildTypes.release.signingConfig = null


elbow95 commented Mar 7, 2016


tavioto commented Mar 12, 2016

Thank you!! this solved my problem

huttarl commented Apr 7, 2016

Thank you, this helped me solve exactly the same problem you had.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.