Search code examples
acra

How to use Acra in release build only?


I am trying to use http://www.acra.ch/ in my Android app.

How can I make it such that ACRA is used only in the release build and not in the debug builds.

I would have to set dependencies accordingly and have my ApplicationController(extends Application) class be configured accordingly.

How to do both? i.e. How to add a dependency for release only and also how to configure my ApplicationController(extends Application) class be configured?

I should mention that I am using my ApplicationController(extends Application) class for some functionality of the app.


Solution

  • Just don't initialize Acra in the debug build:

    if(!BuildConfig.DEBUG) Acra.init(this);
    

    If you want to exclude the dependency in debug build, use releaseCompile