Installing Trace for Android apps

Trace works by installing the Trace SDK to your application during the Bitrise build process. You can do this manually on any device to test it, and once you’re ready to automate your process, you can simply use our dedicated Step on Bitrise.

Android version

The Trace SDK supports Android 5.0 (API level 21) and higher versions. If your app is built with an older version of the Android SDK, you won’t be able to use Trace.

You can install the Trace SDK for Android apps in two ways: you can either do it using Gradle in Android Studio, or simply by adding our dedicated Step to your Workflow.

Installing Trace with Gradle

To install Trace with Gradle, you’ll need to:

  • Add the bitrise-addons-configuration.json file to your app.

  • Initialize the Trace SDK.

Adding the config file to your app

To use Trace on Bitrise, you need to have a bitrise-addons-configuration.json file in your Android project.

  1. Open Trace on Bitrise: go to your app, click the Add-ons tab, find Trace, and click Go to Add-on.

  2. If it’s your first time setting up Trace for an app, you are automatically taken to the Getting started page. If it’s not your first time, you’re taken to the Trace home page: in the top-right, click Getting started.

  3. Choose Gradle from the install options.

    Gradle instructions
  4. On your own device, open Android Studio and place the file in the root of your project.

Initializing the Trace SDK

To start using the Trace SDK, you need to initialize it in your Gradle project.

  1. Open the build.gradle file in the root of your project.

  2. Locate the dependencies block inside the buildscript block and add the following:

    classpath 'io.bitrise.trace.plugin:trace-gradle-plugin:[latestVersion]'

    Please note that [latestversion] is used as a placeholder here. Replace it with the version number of latest version of the Trace SDK, for example, 0.0.3. You can find the latest released version here: Trace SDK.

  3. Open the build.gradle file in your application module.

  4. Add the following after the other apply plugin statements:

    apply plugin: 'io.bitrise.trace.plugin' 
  5. Staying in the application module of the build.gradle file, add the following dependency:

    implementation 'io.bitrise.trace:trace-sdk:[latestVersion]'

Installing Trace for Android with a Bitrise Step

On Bitrise itself, installing Trace is simple: you only need to add the Add Trace SDK Android Step to your Workflow. The Step must come before the application’s binary itself is built. For example, if you build an Android app, the Step must come before the Step that builds your APK or AAB file, such as the Android Build or the Gradle Runner Step.

To install Trace:

  1. Open the Workflow Editor of your app.

  2. Open the Workflow you use to build the app.

  3. Add the Add Trace SDK Android Step before the Step that builds your’s app binary.

  4. Run a build!

If all went well, Trace will track application data.

Once you have the SDK installed, all you need to do is deploy the apps for your users, and watch the data coming in.