0

i want to change isDebug variable when i change built type from debug/relese

here is simple class where i want set true/false isDebug

    public class StartConfig {
    public static boolean isDebug;
    }

here is my build.gradle

buildTypes {
        release {
            minifyEnabled false
            StartConfig.isDebug = false // here i want to set variable
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug 
            StartConfig.isDebug = true // here i want to set variable
            minifyEnabled false
        }

    }

how can i do it ?

OXYGEN
  • 229
  • 2
  • 10

2 Answers2

2

You are doing reverse. just take a look to this link:

How do I detect if I am in release or debug mode?

This is simple easy and no definition required by you.

Ali Khoshraftar
  • 521
  • 1
  • 4
  • 16
1

you can use BuildConfig.DEBUG in your java code. It returns a boolean value