Right now my the app in the internal track has a version code of 565800002 and that in production has a version code of 291302934 which comes from the CircleCI build number * 100,000.

I would like to increment both version code numbers

  • internal and production
  • programmatically, especially the one on internal, but I'm stuck on how to do it.

1 Answers

1
Bharath Mg On

You can use any groovy function or def to build your version code programmatically.

For ex,

**
 * Use the number of seconds/10 since Dec 12 2017 as the versionCode.
 * This lets us upload a new build at most every 10 seconds for the
 * next 680 years.
 */
def verCode = (int) (((new Date().getTime() / 1000) - 1513056598) / 10)

Then in your defaultConfig block, you can use,

versionCode verCode