So I\'m trying to convert all of my ant build scripts to gradle, and I\'ve been able to find ample resources and documentation on all of it except how to configure signing in th
My requirements were that anyone without the keystore should be able to build properly. This is the cleanest way I could find:
android {
signingConfigs {
release //Filled in readSigningConfigIfAvailable()
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-xyz.txt'
readSigningConfigIfAvailable()
}
}
}
private void readSigningConfigIfAvailable() {
if (hasAllSigningProperties()) {
android.signingConfigs.release.storeFile = file(keystore_path)
android.signingConfigs.release.storePassword = keystore_password
android.signingConfigs.release.keyAlias = key_alias
android.signingConfigs.release.keyPassword = key_password
android.buildTypes.release.signingConfig = android.signingConfigs.release
} else {
android.buildTypes.release.signingConfig = null
}
}
private boolean hasAllSigningProperties() {
(hasProperty('keystore_path')
&& hasProperty('keystore_password')
&& hasProperty('key_alias')
&& hasProperty('key_password'))
}