Home » Android » android – Crashlytics doesn't display native crashes

android – Crashlytics doesn't display native crashes

Posted by: admin May 14, 2020 Leave a comment

Questions:

Crashlytics Native report

Before this gets marked as a duplicate, I have tried everything from all the possible questions.
Java crashes are reported properly, however crashes from the native libs don’t have the debug symbols.

What i’ve tried:

./gradlew crashlyticsUploadSymbolsDevDebug // to upload the symbols manually
androidNdkOut 'build/intermediates/ndkBuild/devDebug/obj/local' //specify the ndk paths manually
androidNdkLibsOut 'build/intermediates/merged_native_libs/devDebug/out/lib'` //specify the ndk paths manually

The current setup:

Dependencies:

implementation('com.crashlytics.sdk.android:crashlytics:[email protected]') { transitive = true }

implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.1.1'

android.applicationVariants.all { variant ->
def variantName = variant.name.capitalize()
def task = task("ndkbuild${variantName}")
task.finalizedBy("crashlyticsUploadSymbols${variantName}")
}

crashlytics {
enableNdk true
manifestPath 'AndroidManifest.xml'
androidNdkOut 'build/intermediates/ndkBuild/devDebug/obj/local'
androidNdkLibsOut 'build/intermediates/merged_native_libs/devDebug/out/lib'
}

The fabric dependencies:

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    // The Fabric Gradle plugin uses an open ended version to react
    // quickly to Android tooling updates
    classpath 'io.fabric.tools:gradle:1.31.2'
    }
}

Fabric is setup and working with the Java layer crashes.

Fabric.Builder builder = new Fabric.Builder(this).kits(new Crashlytics(), new 
CrashlyticsNdk());`

The problem: Native crashes get reported but the debug symbols are missing, there are no error/outputs that indicate why they’re missing.

I made a sample app in order to be able to reproduce this more easily.
All you have to do is create a project in firebase and paste the google-services.json file and build.
Link to the repo

How to&Answers:

This might be caused by debug symbols in another module or because of an outdated configuration.

Try to configure it alike this:

crashlytics {
    enableNdk true
    // If using the Android plugin for Gradle version 2.2.0+ with the externalNativeBuild DSL,
    // you should remove the androidNdkOut and androidNdkLibsOut properties, as these paths will
    // automatically be detected by the Fabric plugin.
    androidNdkOut 'obj'
    androidNdkLibsOut 'libs'
    manifestPath 'AndroidManifest.xml'
}

However, you should better migrate to Firebase Crashlytics, because Fabric will shut it down soon:

Crashlytics has been integrated into Firebase, with new Firebase-only features. New apps should use Crashlytics in Firebase to get access to the latest updates and features. Fabric Crashlytics and the Fabric dashboard will be available until March 31, 2020 for existing users.