-
-
Save maxirosson/48c0d8160c758a9145e6 to your computer and use it in GitHub Desktop.
apply plugin: 'com.android.application' | |
ext.versionMajor = 1 | |
ext.versionMinor = 2 | |
ext.versionPatch = 3 | |
ext.versionClassifier = null | |
ext.isSnapshot = true | |
ext.minimumSdkVersion = 19 | |
android { | |
compileSdkVersion 27 | |
buildToolsVersion "27.0.0" | |
defaultConfig { | |
applicationId "com.sample" | |
targetSdkVersion 27 | |
minSdkVersion project.ext.minimumSdkVersion | |
versionCode generateVersionCode() // 190010203 | |
versionName generateVersionName() // 1.2.3-SNAPSHOT | |
} | |
} | |
private Integer generateVersionCode() { | |
return ext.minimumSdkVersion * 10000000 + ext.versionMajor * 10000 + ext.versionMinor * 100 + ext.versionPatch | |
} | |
private String generateVersionName() { | |
String versionName = "${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}" | |
if (ext.versionClassifier == null && ext.isSnapshot) { | |
ext.versionClassifier = "SNAPSHOT" | |
} | |
if (ext.versionClassifier != null) { | |
versionName += "-" + ext.versionClassifier | |
} | |
return versionName; | |
} |
Hi what does ext means here? How does it helps?
ext.versionMajor = 1
ext.versionMinor = 2
ext.versionPatch = 3
ext.versionClassifier = null
ext.isSnapshot = true
ext.minimumSdkVersion = 15
can you help me on how to integrate this gradle file in CI/CD to pass incremental values automatically to these variables for every build
ext.versionMajor = 1
ext.versionMinor = 2
ext.versionPatch = 3
Hi
what will be the max limit for
private Integer generateVersionCode() {
return ext.minimumSdkVersion * 10000000 + ext.versionMajor * 10000 + ext.versionMinor * 100 + ext.versionPatch
}
this
when app version is 9999.9999.9999 is present
will this work?
Hi. This is explained here: https://medium.com/dipien/versioning-android-apps-d6ec171cfd82
The maximum supported version will be 99.99.99
Hi Maxi
I've got my minimum screensize set to 600dp for tablets, how can I setup the third digit — and my actual question is how are you 'changing' this number so I can plan accordingly.
Thanks!!