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
If you build apk via command line like me then you can provide signing configuration as arguments.
Add this to your build.gradle
def getStore = { ->
def result = project.hasProperty('storeFile') ? storeFile : "null"
return result
}
def getStorePassword = { ->
def result = project.hasProperty('storePassword') ? storePassword : ""
return result
}
def getKeyAlias = { ->
def result = project.hasProperty('keyAlias') ? keyAlias : ""
return result
}
def getKeyPassword = { ->
def result = project.hasProperty('keyPassword') ? keyPassword : ""
return result
}
Make your signingConfigs
like this
signingConfigs {
release {
storeFile file(getStore())
storePassword getStorePassword()
keyAlias getKeyAlias()
keyPassword getKeyPassword()
}
}
Then you execute gradlew
like this
./gradlew assembleRelease -PstoreFile="keystore.jks" -PstorePassword="password" -PkeyAlias="alias" -PkeyPassword="password"