I\'ve setup my Android Studio Project to work with Github. Here is my Manifext
apply plugin: \'com.android.application\'
def gitVersion() {
def counter
This method will help you get your revision number:
int extractVersionCode() {
def stdout = new ByteArrayOutputStream()
exec {
workingDir projectDir
executable 'git'
args 'rev-list', '--count', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim().toInteger()
}
Usage:
versionCode extractVersionCode()