Incrementing Android app version

To increment your android app version you will need a script that looks like this:

android {
    compileSdkVersion 21
    buildToolsVersion "21.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        def nevercodeBuild = System.getenv()["NEVERCODE_BUILD"]
        if (nevercodeBuild) {
            logger.quiet("NEVERCODE_BUILD variable is true")
            def buildNumber = System.getenv()["BUILD_NUMBER"]
            logger.quiet("BUILD_NUMBER: " + buildNumber)
            versionName = "1.0." + buildNumber 
            versionCode = Integer.valueOf(buildNumber)
        } else {
            logger.quiet("NEVERCODE_BUILD variable is false")

The script above is just an example script that enables incrementation of android app version

To make your build version management easy, Nevercode exports two environment variables that you can use in your build scripts: NEVERCODE_BUILD and NEVERCODE_BUILD_NUMBER. Read more about their meaning from here.

In your build.gradle script you can check these values with

nevercodeBuild = System.getenv("NEVERCODE_BUILD")
nevercodeBuildNumber = System.getenv("NEVERCODE_BUILD_NUMBER")

Incrementing Android app version