in ~/.gradle/gradle.properties APP.signing=/home/user/.signing/appname/prefix
in /home/user/.signing/appname put 2 files prefix.keystore
the keystore and a gradle snippet with name prefix.gradle
prefix.gradle:
android {
buildTypes {
debug {
buildConfigField 'String', 'BASE_URL', '"https://api-debug.example.com"'
}
release {
buildConfigField 'String', 'BASE_URL', '"https://api.example.com"'
}
}
productFlavors {
vanilla {
buildConfigField 'String', 'BASE_OTHER_URL', '"https://api-vanilla.example.com"'
}
chocolate {
buildConfigField 'String', 'BASE_OTHER_URL', '"https://api-chocolate.example.com"'
}
}
signingConfigs {
release {
storeFile file(project.property("APP.signing") + ".keystore")
storePassword "somepassword"
keyAlias "somealias"
keyPassword "somepassword"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
then in the app build.gradle add the following
if(project.hasProperty("APP.signing")
&& new File(project.property("APP.signing") + ".gradle").exists()) {
apply from: project.property("APP.signing") + ".gradle";
}
Also look at https://hackernoon.com/configuring-android-project-version-name-code-b168952f3323 for auto version numbers and version codes.