问题描述
我根据来设置Firebase Crashlytics Android应用(使用Android Studio 3.1.3)。在我自己的设备以及仿真器上,一切正常,并且我的崩溃在Firebase控制台中正确显示。到目前为止,一切都很好。
I set up Firebase Crashlytics according to Get started with Firebase Crashlytics for my Android app (using Android studio 3.1.3). On my own device as well as on the Emulator, everything works fine and my crashes appear correctly within the Firebase Console. So far so good.
但是,我的一个应用程序用户发生了意外崩溃:
However, there was a crash for one of my app users that was unexpected:
除了MainActivity之外,还有另一个Activity。
The exception was thrown in another Activity than the MainActivity.
I am aware that you could manually execute the initialization as described here by calling Fabric.with(this, new Crashlytics()); However, there is nothing said about one has to manually initialize the Crashlytics in the Getting Started article mentioned above. I was expecting this is done automatically since all my own tests run fine. So why is it that for some users Crashlytics is set up correctly and for some not?
推荐答案
您需要在自己的系统中初始化Crashlytics应用程序的onCreate
You need to initialize Crashlytics in your application's onCreate
import android.app.Application; import com.crashlytics.android.Crashlytics; import io.fabric.sdk.android.Fabric; public class TestApplication extends Application { @Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); } }
这篇关于为什么未初始化Fabric? java.lang.IllegalStateException:必须在使用singleton()之前初始化Fabric的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!