gradle-advanced-build-version
gradle-advanced-build-version copied to clipboard
discourage using date for versionCode
versionCode is an int, it will cause problems in 2022
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 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.
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.