1

When you want to use Crashlytics NDK, you need call Fabric.with(this, new Crashlytics(),new CrashlyticsNdk()); But Firebase Crashlytics calls Fabric.with(context, new Kit[]{new Crashlytics()}); on startup. As the result you cannot use Crashlytics NDK.

How can I avoid this problem?

public class CrashlyticsInitProvider extends ContentProvider {
private static final String TAG = "CrashlyticsInitProvider";

public CrashlyticsInitProvider() {
}

public boolean onCreate() {
    Context context = this.getContext();
    FirebaseInfo firebaseInfo = new FirebaseInfo();
    CrashlyticsInitProvider.EnabledCheckStrategy enabledCheckStrategy = new ManifestEnabledCheckStrategy();
    if (this.shouldInitializeFabric(context, firebaseInfo, enabledCheckStrategy)) {
        try {
            Fabric.with(context, new Kit[]{new Crashlytics()}); // !here
            Fabric.getLogger().i("CrashlyticsInitProvider", "CrashlyticsInitProvider initialization successful");
        } catch (IllegalStateException var5) {
            Fabric.getLogger().i("CrashlyticsInitProvider", "CrashlyticsInitProvider initialization unsuccessful");
            return false;
        }
    }

    return true;
}

2 Answers 2

1

Add this to your AndroidManifest.xml:

<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />

Then initialise Crashlytics manually in your Application subclass:

Fabric fabric = new Fabric.Builder(this)
                .kits(new Crashlytics(), new CrashlyticsNdk())
                .build();
Fabric.with(fabric);

See https://firebase.google.com/docs/crashlytics/force-a-crash#enable_debug_mode

3
  • Where does the CrashlyticsNdk come from? It's not included in the implementation com.crashlytics.sdk.android:crashlytics:2.9.5 firebase crashlytics dependency. Oct 30, 2018 at 12:41
  • @RomanSamoylenko In your build.gradle: implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') { transitive = true } implementation('com.crashlytics.sdk.android:crashlytics-ndk:2.0.5@aar') { transitive = true }
    – NickG
    Nov 6, 2018 at 12:13
  • What does firebase_crashlytics_collection_enabled do? Why disable it? Apr 4, 2019 at 17:06
0

Android NDK crash reports are already supported by Firebase Crashlytics SDK. After you set up Crashlytics with the Firebase Crashlytics SDK, you can add the followings to your app/build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'

dependencies {
    // ...

    // Add the Crashlytics NDK dependency.
    implementation 'com.google.firebase:firebase-crashlytics-ndk:17.0.0-beta01'
}

// …
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
            }
        }
    }
}

See more here: https://firebase.google.com/docs/crashlytics/ndk-reports-new-sdk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.