Install the SDK

This guide explains how to add the FlightRecorder SDK (version 1.4.2) to your Android project using Gradle, leveraging Maven Central as the hosting repository.

Prerequisites

  • Android Studio 4.0+ or later

  • Gradle 6.1.1+ (Android Gradle Plugin 4.0.0+)

  • Internet connection to download dependencies

Add FlightRecorder Dependency

In your module-level build.gradle (usually app/build.gradle), add the FlightRecorder SDK dependency.

Module-level build.gradle (Groovy)

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}
android {
    compileSdkVersion 31
    defaultConfig {
        applicationId "com.example.yourapp"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"
    }
    // ... other configurations
}
dependencies {
    implementation "ai.pulselabs:flightrecorder:1.+" // <--- Add this here
    // ... other dependencies
}

Module-level build.gradle.kts (Kotlin DSL)

plugins {
    id("com.android.application")
    id("kotlin-android")
}
android {
    compileSdk = 31
    defaultConfig {
        applicationId = "com.example.yourapp"
        minSdk = 21
        targetSdk = 31
        versionCode = 1
        versionName = "1.0"
    }
    // ... other configurations
}
dependencies {
    implementation("ai.pulselabs:flightrecorder:1.+") // <--- Add this here
    // ... other dependencies
}

Import via Android Studio UI (Arctic Fox and later)

If you prefer using Android Studio’s graphical interface, follow these steps in Android Studio Electric Eel (2022.1) or newer:

  1. Open your project in Android Studio.

  2. In the Project pane, right‑click the app module and choose Open Module Settings (or press F4).

  3. Select the Dependencies tab.

  4. Click the + button at the top right and choose Library dependency.

  5. In the dialog’s search field, enter ai.pulselabs:flightrecorder:1.4.2 and press Enter.

  6. Select the matching result and click OK.

  7. Click Apply and OK to close the settings.

Android Studio will automatically add the dependency to your build.gradle and sync the project for you.

Sync Your Project

After adding the dependency, click Sync Now in the banner that appears in Android Studio, or run:

./gradlew sync

This will download the FlightRecorder SDK and make it available for use in your code.

The SDK has now been installed into your application.

Update R8 Configuration

  1. Switch to the Project view in Android Studio if you are not already in that view.

  2. Open the folder app, or equivalent for your project, and the file proguard-rules.pro. If the file does not exist, create it.

  3. Add the following to the file:

    proguard-rules.pro
    -dontwarn android.app.Activity$ScreenCaptureCallback

Transitive Dependency Checks

FlightRecorder uses a small number of androidx dependencies. This may impact your application if you use the same dependences, as Gradle will select the latest version in the event two versions are provided, one in the app gradle, and the other by our SDK. In this section we explain how to validate the dependencies and make any necessary updates.

Jetpack Compose

Check the gradle file containing the dependencies block, and look inside that block for references for the following libraries:

If you use the Jetpack Compose BOM, check the version.

  • If the version is lower than version 2024.06.00, then your application will be updated to use 2024.06.00 upon installation of FlightRecorder. Update the version to 2024.06.00 or later, and run thorough testing. If you cannot upgrade, and you use material3, you cannot use the SDK at this time.

  • If the version is 2024.06.00 or higher, no changes are required. Our SDK has been tested with more recent versions and you can proceed to the next steps.

If you manually specify the version of androidx.compose.material3:

  • If the version is lower than 1.2.1, you must update it to 1.2.1 or higher. If you cannot do this, you cannot use the SDK at this time.

An additional couple of steps are required if you do not use the Jetpack Compose BOM:

  1. Check that the versions of the libraries starting with androidx.compose all match the versions of a particular BOM, ensuring they all work together as expected. For example, if you use androidx.compose.animation:animation and androidx.compose.material3:material3, and androidx.compose.animation:animation is using version 1.6.3, then you should also use androidx.compose.material3:material3 version 1.2.1, because those are defined as compatible in BOM 2024.06.00. If you need to use different versions of the libraries, test the SDK carefully. You may find some issues or the app may crash, due to backwards incompatible changes in androidx and these will be resolved by ensuring the versions are compatible.

  2. Add the following libraries explicitly to the gradle file, with the relevant versions from the BOM that matches the versions of the libraries you are using. For example, if you use androidx.compose.animation:animation 1.6.3, then you should use the versions from BOM 2024.06.00.

  • androidx.compose.ui:ui

  • androidx.compose.ui:ui-graphics

  • androidx.compose.ui:ui-tooling-preview

  • androidx.compose.material3:material3

Other Libraries

Check the gradle file containing the dependencies block, and look inside that block for references for the following libraries, and compare the version you use to the version we use:

  • androidx.activity:activity-compose:1.7.0

  • androidx.core:core-ktx:1.10.1

  • androidx.lifecycle:lifecycle-runtime-ktx:2.6.1

  • androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1

If your application does not use any of these libraries, you can proceed.

If your application uses a higher version of all of these libraries, you can proceed. We test the SDK with more recent versions. However, if you encounter any issues when testing the SDK please notify us.

If your application uses a lower version of any of these libraries, and you do not force specific versions, your application will be using the version we specify once the SDK is installed. androidx changes should be backwards compatible, but there are cases where they are not. You have two options:

  1. You could choose to update your gradle file to set a strict version as described here, this will force FlightRecorder to downgrade. You should first contact us and let us know the versions you will need to support, and we can test and validate for you.

  2. You could choose to update the libraries at this time, and re-test your application as you would when updating any core libraries. Gradle will always choose the latest version, so you do not have to update your gradle file for this option, however it is recommended to explicitly specify the versions in your gradle file for clarity.

Last updated