Automaticlly add current GIT SHA value to your apk. It can rise an error if the current git branch is dirty.
Acturally this project is inspried by Why You Should Use a GIT SHA in Your Crash Reporting .
Please read it before using this plugin.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.promeg:android-git-sha-plugin:1.0.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-git-sha'
dependencies {
compile 'com.github.promeg:android-git-sha-lib:1.0.1'
}
gitSha {
buildTypeMatcher = 'release' // RegExp to specify the build type
flavorMatcher = 'inner|fortest' // RegExp to specify the flavor
abortIfGitDirty = true // whether abort build if the current git branch is dirty
}
GitShaUtils.getGitSha(appContext); // return current GIT SHA value.
Then you can add GIT SHA value in your crash reporting.
Crashlytics.setString("git_sha", GitShaUtils.getGitSha(appContext));