Skip to main content

Setting Up Backtrace for Android

Add Backtrace to your Android project to automatically detect and report crashes and exceptions (handled and unhandled) that occur in your apps written in Java or Kotlin.

After you've completed the steps on this page, the Backtrace client will be installed and setup with the default configuration settings.


  • Light-weight Java client library that quickly submits exceptions and crashes to your Backtrace dashboard. Can include callstack, system metadata, custom metadata, and file attachments if needed.
  • Supports a wide range of Android SDKs.
  • Supports offline database for error report storage and re-submission in case of network outage.
  • Fully customizable and extendable event handlers and base classes for custom implementations.
  • Supports detection of Application Not Responding errors (ANRs).
  • Supports monitoring the blocking of manually created threads by providing watchdog.
  • Supports native (JNI/NDK) exceptions and crashes.
  • Supports ProGuard obfuscated crashes.
  • Supports breadcrumbs.

Supported SDKs

  • Minimum SDK version 16 (Android 4.1.x or higher)
  • Target SDK version 30 (Android 11.0)
  • Minimum NDK version 16b
  • Maximum NDK version 22

The ability to capture the battery status when a device is in power saving mode is available from API version 21.

Supported Platforms

  • arm32/arm64
  • x86_64

What You'll Need

  • A Backtrace account (log in or sign up for a free trial license).
  • Your subdomain name (used to connect to your Backtrace instance). For example,
  • A Backtrace project and a submission token.

Install the SDK

Use Gradle or Maven to install the latest version of the reporting library.

// provide the latest version of the Backtrace reporting library.

dependencies {
implementation 'com.github.backtrace-labs.backtrace-android:backtrace-library:<add-latest-version>'

Configure Permissions

In your app's AndroidManifest.xml file, add the following permissions:

  • To send errors to the server instance:

    <uses-permission android:name="android.permission.INTERNET" />
  • To send file attachments from external storage to the server instance:

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Initialize the Backtrace Client

To initialize BacktraceClient, create a BacktraceCredentials object with the name of your subdomain and submission token, and supply it as a parameter in the BacktraceCredentials constructor:

// provide the name of the subdomain for your Backtrace instance and a submission token
BacktraceCredentials credentials = new BacktraceCredentials("{subdomain-name}/{submission-token}/json");

Verify the Setup

At this point, you've installed and setup the Backtrace client to automatically capture exceptions and crashes in your Android app.

To test the integration, throw an exception to send a report to your Backtrace instance.

try {
// throw exception here
} catch (Exception exception) {
backtraceClient.send(new BacktraceReport(e));