Nitt Nitt - 3 months ago 28
Android Question

how to run block of code only in release mode in android

I have two builds variant one is in debugging and other is release. I have to run some block of code in release mode.
For example, I have to use Firebase only in the release build,Is there any way to do that?


For Check the release mode use

 if( BuildConfig.BUILD_TYPE.equalsIgnoreCase("release")) {


debug mode check

 if( BuildConfig.BUILD_TYPE.equalsIgnoreCase("debug")) {


or you can use this code

  if( BuildConfig.DEBUG ){