0

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?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
joe_deniable
  • 2,562
  • 3
  • 28
  • 38

1 Answers1

2

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));
    }
}
Community
  • 1
  • 1
joelreeves
  • 1,955
  • 1
  • 18
  • 24
  • Thanks I will try it. But a comment in that thread says that Crashlytics builder also initialises Answers. I wonder if that is true. – joe_deniable Mar 23 '17 at 16:12
  • Neither of these suggestions works. Using the first piece of code it still initialises Answers and sends tracking events (I have tested this). And even using the second piece of code you have posted, you will still get the built-in events being reported, even if your custom events were not reported. So you can't completely get rid of the tracking behaviour. – joe_deniable Mar 26 '17 at 10:33
  • I'm not sure then. I'd contact their support and see if anything else can be done. – joelreeves Mar 26 '17 at 12:28
  • Try the 3rd was posted here. http://stackoverflow.com/questions/31964038/how-to-disable-crashlytics-answers – joelreeves Mar 26 '17 at 12:43
  • Can also see here that contacting them can get them to disable Answers for you. https://twittercommunity.com/t/how-to-disable-answers-analytics-but-leaving-crash-reporting-enabled/71846 – joelreeves Mar 26 '17 at 12:46
  • When he says he's disabled Answers, what he means is that the data which is sent is just being discarded by the server. Them disabling it doesn't stop the data being sent. But never mind, I am just going to go with the flow and init Crashlytics and Answers together. It's obviously the way it's designed. – joe_deniable Mar 27 '17 at 12:53
  • I recommend using Fabric.with(this, new CrashlyticsCore()); – Mike Bonnell Jun 28 '18 at 17:12