Firebase Crashlytics does not support NDK?

可紊 提交于 2020-02-05 07:31:04

问题


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;
}

回答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



来源:https://stackoverflow.com/questions/50986823/firebase-crashlytics-does-not-support-ndk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!