For the complete documentation index, see llms.txt. This page is also available as Markdown.

Android

Introduction 👋

The bugsplat-android library enables posting native crash reports, Application Not Responding (ANR) events, and user feedback to BugSplat from Android devices. Visit bugsplat.com for more information and to sign up for an account.

Requirements 📋

  • Android Gradle Plugin (AGP): 8.5.1 or higher (for 16KB page size support)

  • Android NDK: r27 or higher recommended

  • minSdkVersion: 21 or higher

  • targetSdkVersion: 35 or higher recommended

Starting November 1st, 2025, Google Play requires all new apps and updates targeting Android 15+ to support 16 KB page sizes. The BugSplat Android SDK is built with 16KB ELF alignment to comply with this requirement.

Integration 🏗️

bugsplat-android supports multiple installation methods.

Add the BugSplat dependency to your app's build.gradle file:

dependencies {
    implementation 'com.bugsplat:bugsplat-android:1.3.0'
}

BugSplat is hosted on Maven Central, which is included by default in most Android projects. If needed, ensure mavenCentral() is in your settings.gradle.kts:

Manual Setup

To integrate BugSplat using the AAR file:

  1. Go to the Releases page and download the latest bugsplat-android-x.y.z.aar file.

  2. Copy the AAR into your app module's libs/ directory.

  3. In your app-level build.gradle, add:

  1. In your AndroidManifest.xml, add the required permissions:

Usage 🧑‍💻

Keeping your database, application, and version values in one place avoids drift between runtime (BugSplat.init) and symbol upload. The pattern most BugSplat users adopt:

1. Add the database name to the gitignored local.properties:

2. In your app module's build.gradle, load it and expose it (plus applicationId and versionName) as BuildConfig fields:

This same bugsplat.database value is picked up by the symbol upload task below, so there's a single source of truth across the whole build. See example/build.gradle for the complete setup.

Initialization

Initialize BugSplat from your launch Activity — typically in onCreate:

Java

Kotlin

Custom Attributes

Attach arbitrary key/value pairs to crash reports. Attributes can be set at init time or updated at any time afterward:

Keys and values are each limited to 255 bytes.

Attachments

Attach files to crash reports by passing their paths to init:

ANR Detection

bugsplat-android automatically detects and reports Application Not Responding (ANR) events on Android 11+ (API 30+) using the ApplicationExitInfo API.

When the system kills your app due to an ANR, the event is recorded by Android. On the next app launch, the SDK queries ActivityManager.getHistoricalProcessExitReasons() for new ANRs, reads the system-provided thread dump, and uploads it to BugSplat. ANR reports appear alongside crashes with the "Android.ANR" type.

The thread dump includes:

  • Full Java stack traces for all threads in the process

  • Native stack frames with BuildIds (symbolicated against uploaded .sym files)

  • Lock contention information

ANR detection is enabled automatically when you call BugSplat.init() — no additional configuration required. The SDK persists the timestamp of the last reported ANR in SharedPreferences to avoid duplicate uploads.

ANR detection requires Android 11+ (API 30+). On older versions, ApplicationExitInfo is unavailable and ANR detection is silently disabled.

To test ANR detection, call BugSplat.hang() from the main thread:

User Feedback

Submit non-crashing feedback (bug reports, feature requests) using BugSplat.postFeedback. Feedback reports appear in BugSplat with the "User Feedback" type.

File attachments can be included by passing a List<File>:

Custom key/value attributes can also be attached to the feedback report. They're JSON-encoded into the attributes field on the commit request:

Shake-to-Feedback

A common UX pattern for beta builds is to open the feedback dialog when the user shakes the device. The SDK doesn't ship a built-in shake detector, but it's a small amount of code on top of SensorManager — register for Sensor.TYPE_ACCELEROMETER, watch for a few accelerometer samples above ~2.7G inside a 1s window, then invoke whichever UI surfaces your postFeedback call:

See ShakeDetector.java in the example app for a copy-pasteable implementation that adds debouncing and a cooldown to avoid spurious triggers.

Native Library Packaging

To ensure native libraries (and their debug info) are properly deployed, configure your app's build.gradle:

Symbol Upload 🔣

To symbolicate native stack frames in crash and ANR reports, upload your app's unstripped .so files to BugSplat as Breakpad .sym files. There are three ways to do this.

Wire symbol upload into your Gradle build so it runs automatically after assembleDebug / assembleRelease. Credentials are loaded from the gitignored local.properties to avoid committing them.

Step 1 — Add credentials to local.properties:

Step 2 — In build.gradle, load credentials and register per-ABI upload tasks:

See example/build.gradle in the SDK repo for the complete, copy-pasteable implementation.

Get your clientId and clientSecret from the BugSplat Integrations page.

2. Built-in Programmatic Upload

The SDK exposes BugSplat.uploadSymbols to upload symbols at runtime (useful if you need to kick this off from app code rather than Gradle):

This requires bundling the symbol-upload binary in your app's assets. See the Example App README for details.

3. Command-Line Tool

You can also invoke symbol-upload directly from the command line:

Please refer to the symbol-upload documentation for full usage details.

Sample Application 🧑‍🏫

The bugsplat-android repository includes a full example app that demonstrates:

  • Initializing the SDK at app startup

  • Triggering a native crash

  • Triggering an ANR (via BugSplat.hang()) to test ANR detection and native frame symbolication

  • Submitting user feedback via a dialog (also openable by shaking the device)

  • Setting custom attributes via a dialog

  • Uploading symbols via Gradle

To run it:

  1. Open in Android Studio.

  2. Add your BugSplat credentials to local.properties as described in the Symbol Upload section above.

  3. Select the example run configuration and click Run.

See the Example App README for more details.

Last updated

Was this helpful?