Skip to content

Automaticlly add current GIT SHA value to your apk. It can rise an error if the current git branch is dirty.

License

Notifications You must be signed in to change notification settings

promeG/android-git-sha-plugin

Repository files navigation

android-git-sha-plugin

Download

Automaticlly add current GIT SHA value to your apk. It can rise an error if the current git branch is dirty.

Why you should use a GIT SHA in your crash reporting.

Acturally this project is inspried by Why You Should Use a GIT SHA in Your Crash Reporting .

Please read it before using this plugin.

How to use android-git-sha-plugin

1. Add to your project

In your project's root build.gradle file.

buildscript {
  repositories {
    jcenter()
  }

  dependencies {
    classpath 'com.github.promeg:android-git-sha-plugin:1.0.1'
  }
}

In your application module's build.gradle file.

apply plugin: 'com.android.application'
apply plugin: 'android-git-sha'

dependencies {
  compile 'com.github.promeg:android-git-sha-lib:1.0.1'
}

2. Config plugin

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
}

3. Read GIT SHA value in java code

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));

About

Automaticlly add current GIT SHA value to your apk. It can rise an error if the current git branch is dirty.

Resources

License

Stars

Watchers

Forks

Packages

No packages published