本文介绍了如何初始化Crashlytics在Fabric.io?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寻找一些帮助。我刚刚升级我的Andr​​oid应用程序,以面料,现在在这条线的应用程序提供了一个错误:

Looking for some help. I just upgraded my android app to fabric and now the app gives an error on this line:

Crashlytics.start(getApplicationContext());

摇篮:错误:无法找到符号的方法开始(上下文)

我想注释掉该行,但随后的崩溃都没有得到记录。在新的面料框架怎样初始化Crashlytics?我失去了一些东西?

I tried commenting out that line, but then the crashes are not getting logged. How do I initialize Crashlytics in the new fabric framework? Am I missing something?

在此先感谢您的帮助。

推荐答案

由于Crashlytics现在是结构的一部分初始化过程中发生了变化,但仍然是简单的。而不是使用 Crashlytics.start()您现在应该使用,但在应用程序创建

Since Crashlytics is now part of Fabric the initialization process has changed, but is still simple. Instead of using Crashlytics.start() you should now use, but in the Application creation:

public class App extends Application {

    ...

    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(this, new Crashlytics());
    }

    ...

}

有关更丰富的示例,请参见典型示例应用程序是如何炮弹做的:

For a more richer example, see how Cannonball canonical sample app is doing:

public class App extends Application {

    ...

    private TwitterAuthConfig authConfig;

    ...

    @Override
    public void onCreate() {
        super.onCreate();
        authConfig = new TwitterAuthConfig(BuildConfig.CONSUMER_KEY, BuildConfig.CONSUMER_SECRET);
        Fabric.with(this, new Crashlytics(), new Twitter(authConfig), new MoPub());
    }

    ...

}

这code,请访问:https://github.com/twitterdev/cannonball-android/blob/master/app/src/main/java/io/fabric/samples/cannonball/App.java#L96-L98

这篇关于如何初始化Crashlytics在Fabric.io?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 20:16