Created
February 4, 2021 21:16
-
-
Save florinmuscalu/10e1d6c76d012c0b64ec4b39460edbf6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
def versionFile = file('version.properties') | |
Properties prop = new Properties() | |
if (versionFile.canRead()) { | |
prop.load(new FileInputStream(versionFile)) | |
} | |
else { | |
prop['VERSION_CODE']='0' | |
} | |
def code = prop['VERSION_CODE'].toInteger() + 1 | |
prop['VERSION_CODE']=code.toString() | |
prop.store(versionFile.newWriter(), null) | |
defaultConfig { | |
... | |
versionCode code | |
versionName "1.0" | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment