I would like to have my Gradle build to create a release signed apk file using Gradle.
I\'m not sure if the code is correct or if I\'m missing a parameter when doing
Almost all platforms now offer some sort of keyring, so there is no reason to leave clear text passwords around.
I propose a simple solution that uses the Python Keyring module (mainly the companion console script keyring
) and a minimal wrapper around Groovy ['do', 'something'].execute()
feature:
def execOutput= { args ->
def proc = args.execute()
proc.waitFor()
def stdout = proc.in.text
return stdout.trim()
}
Using this function, the signingConfigs
section becomes:
signingConfigs {
release {
storeFile file("android.keystore")
storePassword execOutput(["keyring", "get", "google-play", storeFile.name])
keyAlias "com.example.app"
keyPassword execOutput(["keyring", "get", "google-play", keyAlias])
}
}
Before running gradle assembleRelease
you have to set the passwords in your keyring, only once:
$ keyring set google-play android.keystore # will be prompted for the passwords
$ keyring set google-play com.example.app
Happy releases!