Get Android NDK crash reports with the Firebase Crashlytics SDK

If your Android app contains native libraries, you can enable full stack traces and detailed crash reports for your native code from Firebase Crashlytics with a few small updates to your app's build configuration. This guide describes how to configure crash reporting with the new Firebase Crashlytics SDK.

Before you begin

To get started, set up Crashlytics with the Firebase Crashlytics SDK.

Step 1: Update your Gradle configuration

In your app-level build.gradle, add the Crashlytics NDK runtime dependency:

apply plugin: ''
apply plugin: ''

dependencies {
    // ...

    // Add the Crashlytics NDK dependency.
    implementation ''

// …
android {
    // ...
    buildTypes {
        release {
            // Add this extension
            firebaseCrashlytics {
                // Enable processing and uploading of native symbols to Crashlytics
                // servers. By default, this is disabled to improve build speeds.
                // This flag must be enabled to see properly-symbolicated native
                // stack traces in the Crashlytics dashboard.
                nativeSymbolUploadEnabled true

Step 2: Enable native symbol uploading

To produce readable stack traces from NDK crashes, Crashlytics needs to know about the symbols in your native binaries. Our Gradle plugin includes the uploadCrashlyticsSymbolFileBUILD_VARIANT task to automate this process (to access this task, make sure nativeSymbolUploadEnabled is set to true).

For method names to appear in your stack traces, you must explicitly invoke the uploadCrashlyticsSymbolFileBUILD_VARIANT task after each build of your NDK library. For example:

>./gradlew app:assembleBUILD_VARIANT\

Step 3: See your crash reports

Verify that Crashlytics is properly reporting NDK crashes by building your app, uploading symbols, and forcing a native crash. You’ll need to restart the app after it crashes for Crashlytics to send the report. You should see the crash in your Firebase console within a few minutes.