Skip to content

Instantly share code, notes, and snippets.

@kibotu
Last active September 18, 2015 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kibotu/121e5ea6b9d0ae76ff89 to your computer and use it in GitHub Desktop.
Save kibotu/121e5ea6b9d0ae76ff89 to your computer and use it in GitHub Desktop.
crashlytics hack to set different version name
private void setupCrashlytics(@NotNull final Activity activity) {
final Crashlytics crashlytics = new Crashlytics();
// hack to set fully classified version name @see gradle task.canonicalReleaseVersionName
try {
final Field versionNameField = CrashlyticsCore.class.getDeclaredField("versionName");
versionNameField.setAccessible(true);
versionNameField.set(crashlytics.core, Build.getValue(CANONICAL_VERSION_NAME));
} catch (Exception e) {
e.printStackTrace();
}
Fabric.with(activity, crashlytics);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment