joe_deniable
joe_deniable

Reputation: 2572

Initialise Crashlytics error reporting by itself without Answers etc

I want to initialise CrashlyticsCore, which just has error reporting, not Crashlytics, which has automatic built in usage reporting.

I have found this answer: How do i initialize the new version of crashlytics?

Which says to do this:

Fabric.with(this, new CrashlyticsCore.getInstance());

I am not sure whether the "new" keyword is meant to be there. However, with or without "new", it gives the following error:

java.lang.IllegalStateException: Must Initialize Fabric before using singleton()

Does anyone know how to just initialise CrashlyticsCore without Crashlytics?

Upvotes: 0

Views: 771

Answers (1)

joelreeves
joelreeves

Reputation: 1954

You can try the answer in this thread

Fabric.with(this, new Crashlytics.Builder().core(new CrashlyticsCore.Builder().build()).build());

Or you can create a method that only enables sending Answer events based on a boolean flag:

public static void logCustom(boolean isEnabled, String eventText) {
    if (isEnabled) {
        Answers.getInstance().logCustom(new CustomEvent(eventText));
    }
}

Upvotes: 2

Related Questions