Some talk about BuildConfig and how to customize it

Updated 22 December 2016


Android Studio supports Gradle for doing the actual building of the app. There’s a class called which is automatically generated by the build system. This class is updated automatically by Android’s build system (like the R class).

It already contains a static final boolean called DEBUG, which is normally set to true.

The simple explanation is that default values are set initially before Proguard is run, then after Proguard runs, the BuildConfig file is regenerated with the proper values. However, Proguard has already optimized your code by this point and you have issues.


ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. For more details.


How to customize BuildConfig and create your own variable accordingly

Step 1. Create your field in your build.grab,

Step 2. In your define,

Step 3. You can use it anywhere in the app,

Thank you maybe, this blog is useful for you.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home