Question: BuildConfig.DEBUG is not working (= logically set to false) when I run my app in debug mode.
I use Gradle to build. I have a library project where I do this check. BuildConfig.java looks like this in the build debug folder:

```
/** Automatically generated the file. DO NOT MODIFY */
package common.myProject;

public final class BuildConfig {
    public static final boolean DEBUG = Boolean.parseBoolean("true");

}

```

and in the release folder:

```
public static final boolean DEBUG = false;

```

both in the library project and in the application project.

I tried to get around this by checking a variable which is set a class of my project. This class inherits from the library and starts on startup.

```
<application
        android:name=".MyPrj" ...

```

This leads to another problem: is that I use my DEBUG variable in a DataBaseProvider which runs before the application class, and it will not run properly due to this bug.

Answer: 
You can create your own BuildConfig class for each build type using gradle

```
public class MyBuildConfig
{
    public static final boolean DEBUG = true;
}

```

for **/src/debug/.../MyBuildConfig.java** and...

```
public class MyBuildConfig
{
    public static final boolean DEBUG = false;
}

```

for **/src/release/.../MyBuildConfig.java**

Then use:

```
if (MyBuildConfig.DEBUG)
    Log.d(TAG, "Hey! This is debug version!");

```
You could try this on each of the projects buildTypes:

```
parent.allprojects.each{ project -> android.defaultConfig.debuggable = true}

```