Get Android NDK crash reports

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.

Before you begin

To get started, set up Crashlytics for Android.

Update your Gradle configuration

In your app-level build.gradle, enable the Crashlytics NDK flag and add the Crashlytics NDK dependency.

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

// Enable Crashlytics NDK reporting
crashlytics {
    enableNdk true
}

dependencies {
    // ...

    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'

    // Add the Crashlytics NDK dependency
    implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.1.1'
}

Upload native symbols

To produce readable stack traces from NDK crashes, Crashlytics needs to know about the symbols in your native binaries. Our Gradle plugin includes the crashlyticsUploadSymbols{variant} task to automate this process.

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

./gradlew crashlyticsUploadSymbolsRelease

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.