How to disable Crashlytics Answers?

后端 未结 3 1684
南笙
南笙 2020-12-17 21:05

Disabling Crashlytics error reporting is relatively straight forward.. I\'d also like to disable Answers for debug builds. However,

new Crashlytics.Builder(         


        
3条回答
  •  离开以前
    2020-12-17 21:40

    on my app we do it the old fashioned way:

    if (!IS_DEBUG) {
       Fabric.with(this, new Crashlytics());
    }
    

    works fine.

    Of course you can initialise with whichever custom parameters you need.

    edit:

    to get the debug boolean is just a matter of using gradle to your favour:

    src/
       main/ // your app code
       debug/
           AppSettings.Java:
                public static final boolean IS_DEBUG = true;
       release/
           AppSettings.Java:
                public static final boolean IS_DEBUG = false;
    

    edit:

    I would advise against using BuildConfig.DEBUG, see this article: http://www.digipom.com/be-careful-with-buildconfig-debug/

提交回复
热议问题