File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,12 +155,17 @@ android {
155155
156156 val versionStr = if (version == " unspecified" ) " 1.0.0" else version.toString()
157157 versionName = versionStr
158- versionCode = with (versionStr.toVersion()) {
159- major * 10_000_000 +
160- minor * 10_000 +
161- patch * 100 +
162- (preRelease?.substringAfterLast(' .' )?.toInt() ? : 0 )
163- }
158+
159+ // VersionCode derived from current time (1-minute intervals) + offset.
160+ val nowMillis = System .currentTimeMillis()
161+ val timestampVersionCode = (nowMillis / (60 * 1000 )).toInt()
162+ // Offset of the prior v1.1.1 version code to ensure the code is always newer for old installs.
163+ // If a new app is used this offset should be changed to zero.
164+ // 1 minute rounding and this offset still gives ~4,000 years of valid version codes
165+ // and still fall into Play store max version code range.
166+ val versionCodeOffset = 10010100
167+ versionCode = timestampVersionCode + versionCodeOffset
168+
164169 vectorDrawables.useSupportLibrary = true
165170 }
166171
You can’t perform that action at this time.
0 commit comments