Skip to content

Instantly share code, notes, and snippets.

Last active Mar 13, 2022
What would you like to do?
Example showing how to read a build number from a CI system for automatic build numbers
android {
// is only used to get the version number from CircleCi
def versionFile = file('../.signing/')
def buildNumber = 456
if(versionFile.canRead()) {
Properties props = new Properties()
props.load(new FileInputStream(versionFile))
//Add skip_appcenter_release in a commit message to develop/master/release if you don't want a build to be created by CircleCi
if(props['VERSION_CODE'] != null) {
def circleBuildNumber = props['VERSION_CODE'].toInteger()
buildNumber = circleBuildNumber - 3870 //subtract offset to get close to our real build number
defaultConfig {
versionCode buildNumber
versionName "1.2.3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment