In the end, I used an interesting solution from this site.
The idea is to save the variables in a separate folder, which is stored in a remote repository .
In the file ~/.gradle/gradle.properties you put:
Keys.repo=/Users/username/.signing
where Keys.repo is the local path to the remote repository.
Later in /Users/username/.signing/YourProjectName.properties you have:
RELEASE_STORE_FILE=/YourProjectName/release.keystore
You need to save the release.keystore file in /Users/username/.signing/YourProjectName/release.keystore path
The configuration is used as follows:
android { signingConfigs { debug { /* no changes - usual config style */ } release { if (project.hasProperty("Keys.repo")) { def projectPropsFile = file(project.property("Keys.repo") + "/YourProjectName.properties") if (projectPropsFile.exists()) { Properties props = new Properties() props.load(new FileInputStream(projectPropsFile)) storeFile file(file(project.property("Keys.repo") + props['RELEASE_STORE_FILE'])) storePassword props['RELEASE_STORE_PASS'] keyAlias props['RELEASE_ALIAS'] keyPassword props['RELEASE_KEY_PASS'] } } else { println "=======================================================" println "[ERROR] - Please configure release-compilation environment - eg in ~/.signing directory" println "=======================================================" } } } }
source share