When installing "Crashlytics" in my Android App, it automatically installs "Answers". I only want to install "Crashlytics" and want to have "Answers" disabled. Does anyone know how to do that?
build.gradle
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
Thanks!
Each user would need to head to their Firebase console and click on the Alert tab or use this link: https://firebase.google.com/u/0/subscriptions/overview Select the project and then turn off emails for Crashlytics.
Enable debug logging for Crashlytics If you don't see your test crash in the Crashlytics dashboard, you can use debug logging for Crashlytics to help track down the problem. Enable debug logging: In Xcode, select Product > Scheme > Edit scheme. Select Run from the left menu, then select the Arguments tab.
Android Crash Reporting Tools Fabric - Crashlytics Fabric is a modular mobile platform that provides useful kits you can mix to build your application. Crashlytics is a crash and issue reporting tool provided by Fabric that allows you to track and monitor your applications in detail.
Crashlytics saves you troubleshooting time by intelligently grouping crashes and highlighting the circumstances that lead up to them. Find out if a particular crash is impacting a lot of users. Get alerts when an issue suddenly increases in severity.
Mike from Fabric and Crashlytics here.
As you saw, Crashlytics by default includes Answers. If you don't want Answers enabled on your app, then you want to invoke CrashlyticsCore()
when building your app instead of Crashlytics
.
For example, have these as your imports:
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import io.fabric.sdk.android.Fabric;
Then when you initialize Fabric, use:
Fabric.with(this, new CrashlyticsCore());
and that will initialize only the crash reporting side of things.
I think it is not possible at the moment, because Crashlytics is making an Answers instance:
public Crashlytics build() {
if(this.coreBuilder != null) {
if(this.core != null) {
throw new IllegalStateException("Must not use Deprecated methods delay(), disabled(), listener(), pinningInfoProvider() with core()");
}
this.core = this.coreBuilder.build();
}
if(this.answers == null) {
this.answers = new Answers();
}
if(this.beta == null) {
this.beta = new Beta();
}
if(this.core == null) {
this.core = new CrashlyticsCore();
}
return new Crashlytics(this.answers, this.beta, this.core);
}
Crashlytics(Answers answers, Beta beta, CrashlyticsCore core) is not public, so we cannot instanciate this. Also the answers field is final, so you cannot override it. I think there is now way to let the user decide if they want to use answers.
Hey Fabric/Google, you should make a programmatically way to opt out for a session, to give the programmer the option to let the user decide if they want to be counted in some way.
EDIT
My solution is to to use a wraper for all needed funtioncs and init, feel free to use it:
public class AnalyticsWrapper {
static AnalyticsWrapper instance;
public static void initialize(Context context, boolean optOut) {
if (instance != null) throw new IllegalStateException("AnalyticsWrapper must only be initialized once");
instance = new AnalyticsWrapper(context.getApplicationContext(), optOut);
}
public static AnalyticsWrapper getInstance() {
if (instance == null) throw new IllegalStateException("AnalyticsWrapper must be initialized before");
return instance;
}
final boolean optOut;
private AnalyticsWrapper(Context context, boolean optOut) {
this.optOut = optOut;
initFabric(context);
}
public boolean isOptOut() {
return optOut;
}
private void initFabric(Context context) {
if (!optOut) {
if (!BuildConfig.DEBUG) {
Timber.plant(new CrashlyticsLogExceptionTree());
Timber.plant(new CrashlyticsLogTree(Log.INFO));
}
Crashlytics crashlyticsKit = new Crashlytics.Builder().core(
new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG)
.build())
.build();
Fabric fabric = new Fabric.Builder(context).kits(crashlyticsKit)
.debuggable(BuildConfig.DEBUG)
.build();
Fabric.with(fabric);
}
}
public void crashlyticsSetString(String key, String value) {
if (!optOut) {
Crashlytics.setString(key, value);
}
}
public void logException(Throwable throwable) {
if (!optOut) {
Crashlytics.logException(throwable);
}
}
public void logEvent(CustomEvent event) {
if (!optOut) {
Answers.getInstance()
.logCustom(event);
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With