Migrating from Fabric to firebase Crashlytics

582 views Asked by At

i am migrating from Fabric to Firebase crashlytics in my android project, I have changed all the gradle files accordingly as per https://firebase.google.com/docs/crashlytics/get-started?platform=android#java

But in my Analytics file i have import which I want to convert to FirebaseAnalytics

import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.CustomEvent;

I have changed the import to

import com.google.firebase.analytics.FirebaseAnalytics;

but not sure how can I use to this code

private static void logCrashlyticsEvent(String event, Map<String, String> map, App app, Settings settings, DeviceTools deviceTools, boolean addGenericData) {
    CustomEvent analyticEvent = new CustomEvent(event); // Custom event needs changing


    if (map != null){
        for (Map.Entry<String, String> entry: map.entrySet()){
            analyticEvent.putCustomAttribute(entry.getKey(), entry.getValue());
        }
    }

    Answers.getInstance().logCustom(analyticEvent); // Answers needs changing
}

please suggest how to fix this

Thanks a ton in advcance

Rao

1

There are 1 answers

0
Nit On

According to the Fabric to Firebase Crashlytics migration guide:

You can no longer collect data with Fabric Answers after upgrading to the Firebase Crashlytics SDK. To get metrics for crash-free users and breadcrumbs, switch over to using Google Analytics instead. Note that your historical Answers data cannot migrate to Firebase.

Visit Start using Google Analytics to learn how to add Google Analytics to your app.