如何初始化新版本的crashlytics? [英] How do i initialize the new version of crashlytics?
本文介绍了如何初始化新版本的crashlytics?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用以下方法初始化应用程序时,一切正常:
Everything works fine when I initialize my application with:
Fabric.with(this, new Crashlytics());
但是,使用时会出现异常:
However, I get an exception when I use:
Fabric.with(this, new CrashlyticsCore());
以下例外:
FATAL EXCEPTION: main Process: com.weightbook, PID: 19438
java.lang.IllegalStateException: Crashlytics must be initialized by calling Fabric.with(Context) prior to calling Crashlytics.getInstance()
at com.crashlytics.android.Crashlytics.checkInitialized(Crashlytics.java:372)
at com.crashlytics.android.Crashlytics.setUserName(Crashlytics.java:248)
at com.weightbook.analytics.AnalyticsManager.setUsernameOnCrashlytics(AnalyticsManager.java:64)
推荐答案
来自Fabric和Crashlytics的Mike。您的第一个初始化调用是正确的,但是您也可以使用:
Mike from Fabric and Crashlytics here. Your first init call is correct, but you could also use:
Fabric.with(this, new CrashlyticsCore(), new Crashlytics());
或使用:
Fabric.with(this, CrashlyticsCore.getInstance());
具有以下进口:
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.core.CrashlyticsCore;
import io.fabric.sdk.android.Fabric;
仅使用 CrashlyticsCore.getInstance()
将仅向您提供Crashlytics崩溃报告,而没有其他内容,例如 new Crashlytics()
将包含Beta和Answers。
Using just CrashlyticsCore.getInstance()
will give you only Crashlytics crash reporting and nothing else, where as new Crashlytics()
would include Beta and Answers.
这篇关于如何初始化新版本的crashlytics?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文