Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Fabric Android shell


This is the doc for

Invoking the Fabric plugin by standalone (non-jvm) processes So our plugin has 3 responsibilities:

  • (pre-build) Enable your app on our backend
  • (pre-build) Injecting a build ID to associate those mapping files to that build
  • (post-build) Upload mapping files

This shell script breaks down those steps into two functions: pre-build and post-build.

When this jar runs, output is logged to a folder.

  • On Linux / Windows: ~/.crashlytics/
  • On Mac: ~/Library/Caches/com.crashlytics/

Mapping files are also cached in a folder relative of /

Build steps

get_fabric_tool (optional)

This is a quick-and-dirty tool to bootstrap downloading the plugin if you don't have access to a dependency manager. Please replace this with a real maven-protocol backed dependency manager if you're able.

Pre-Build steps

The pre-build steps include generating the ID enabling the app on our backend. This step must run after the manifest is processed and the assets are merged. This is because:

  • Plugin is reading the manifest, and adding assets
  • Plugin is adding assets (the asset is for beta distribution, see: )
  • Plugin is adding a resource (used to deobfuscate crashes)

Post-Build steps

Cache the mapping file, then try to upload it after every build.


Build ID

IMPORTANT: This build_id must match between pre_build and post_build If you call this script twice, it will be different, so you may want to inject it into the script. It can be generated via uuidgen, We generate it via java.util.UUID.randomUUID().toString()


You can speed up your build slightly by only updating this ID for release builds, feel free to parameterize this. Can be false, whenever, but faster if you set true for:

  • Normal non-release builds
  • Instant run non-release builds
  • Non-proguarded apps in general


Path your mapping file is generated. In Gradle, this is variant.mappingFile


Root path of the app project, likely .


This should be the generated build/ manifest during the build for the variant In Gradle, we use variant.outputs[0].processResourceTask.manifestFile.toString()


This is a pointer to a real root manifest on disk. In Gradle, we use src/main/AndroidManifest.xml if you run this from the app/ folder


Resource path for the variant, we use { it.exists() }


Asset path for the variant, we use assetsPath = { it.exists() }


This is where we will put the build id during the build when the generate resources task is called Currently, in modern Android Gradle plugin, there's a task, variant.registerResGeneratingTask, that we call. We pass into that task project.buildDir + "/generated/fabric/res" + variant.dirName


This is optional and can safely be empty. We use this to allow open source projects to inject in their api key from an uncommitted file. ( see: )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment