gradle-advanced-build-version icon indicating copy to clipboard operation
gradle-advanced-build-version copied to clipboard

discourage using date for versionCode

Open AndroidGecko opened this issue 8 years ago • 3 comments

versionCode is an int, it will cause problems in 2022

AndroidGecko avatar Jul 30 '15 15:07 AndroidGecko

What do you recommend? currently date format is year|month|day|hour|minutes. I have used hour and minutes so it can cover releasing more than one version in a day and because of this the versoinCode is so long. Do you think year|month|day is enough for building versoinCode?

moallemi avatar Aug 19 '15 04:08 moallemi

@moallemi year|month|day would be unsufficient since on CI with auto deplyment to play store this value needs to be different on each build. In that case build-id from CI is best option as versionCode. It is worth mentioning since many peopel think versionCode is a long value.

AndroidGecko avatar Aug 19 '15 05:08 AndroidGecko

it will cause problems in 2022

This is not the case. This will function until the end of 2035. The integer is calculated here return Integer.parseInt(formatter.format(new Date())) - 1400000000;.

This means that is takes year|month|day|hour|minutes and minuses everything from before 2014, doing so will mean that the last date that will be under the max int limit (2147483647) will be 3512312359.

MitchellMcCluskey avatar Jun 02 '16 06:06 MitchellMcCluskey