Skip to content

backtrace-labs/backtrace-android

Repository files navigation

Backtrace Integration with Android

Maven Central Build Status javadoc License: MIT

Backtrace's integration with Android applications written in Java or Kotlin allows you to capture and report handled and unhandled java exceptions so you can prioritize and debug software errors. Backtrace also captures and reports native (JNI/NDK) handled and unhandled exceptions if native integration is enabled.

Installation

Gradle

// provide the latest version of the Backtrace reporting library.
dependencies {
    implementation 'com.github.backtrace-labs.backtrace-android:backtrace-library:<add-latest-version>'
}

Maven

<!-- provide the latest version of the Android SDK. -->
<dependency>
  <groupId>com.github.backtrace-labs.backtrace-android</groupId>
  <artifactId>backtrace-library</artifactId>
  <version><add-latest-version></version>
  <type>aar</type>
</dependency>

Usage

Java

// replace with your submission url 
BacktraceCredentials credentials = new BacktraceCredentials("<submissionUrl>");
BacktraceClient backtraceClient = new BacktraceClient(getApplicationContext(), credentials);

// send test report
backtraceClient.send("test");

// Capture uncaught exceptions
BacktraceExceptionHandler.enable(backtraceClient);

// Enable ANR detection
backtraceClient.enableAnr();

// Enable Crash Free metrics
backtraceClient.metrics.enable();

Kotlin

// replace with your submission url
val credentials = BacktraceCredentials("<submissionUrl>")
val backtraceClient = BacktraceClient(applicationContext, credentials)

// send test report
backtraceClient.send("test")

// Capture uncaught exceptions
BacktraceExceptionHandler.enable(backtraceClient)

// Enable ANR detection
backtraceClient.enableAnr()

// Enable Crash Free metrics
backtraceClient.metrics.enable()

Documentation

For more information about the Android SDK, including installation, usage, and configuration options, see the Android Integration guide in the Sauce Labs documentation.