Skip to content

nillith/AutoVersion

Repository files navigation

AutoVersion

Gradle plugin for managing android app versionCode and versionName. Auto update versionCode on every git commit.

Read this in other languages: English, 简体中文.

How to use

####1 Dependencies

In root project build.gradle file

buildscript {
	...
    dependencies {
        classpath 'com.nillith.android:autoversion:1.1.0'
        ...
    }
}

####2 Config In app module build.gradle file

...
apply plugin: 'com.nillith.autoversion'

// Config your version numbers here. 
autoVersion {
    major 1
    minor 0
    patch 0
    // build 3 // You can provide your own build number to disable auto versionCode update.
}


android {
...
    defaultConfig {
        ...
        versionCode autoVersion.code // same as build.
        versionName autoVersion.name // same as "$major.$minor.$patch.$build"
		...
    }
	...
}

If doing right. Gradle console will print the following message when sync

AutoVersion:versionCode: xxx
AutoVersion:versionName: x.x.x.x

License

Nillith, 2016. Licensed under an Apache-2 license.

About

Generate versionCode and versionName for android app based on git commit count automatically

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published