Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BuildConfig file in android - Purpose and Possibilities

Tags:

android

Android has a flag called DEBUG in BuildConfig.java. Can someone please explain how is this file created? What is the purpose of having an auto-generated file with a single variable in it?

Is it possible to have something besides DEBUG flag inside this class? What if I want a configuration other than development and release configuration? How can I achieve it?

like image 596
Prateek Avatar asked Dec 09 '14 15:12

Prateek


People also ask

What is BuildConfig in Android?

What is BuildConfig? Gradle generates a BuildConfig class that contains static configuration constants that are specific to the build at build time. The class includes default fields such as debug and flavor, but you can override them with build.

How is BuildConfig generated?

There's a class called BuildConfig. java 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.

Where is BuildConfig in Android?

BuildConfig. java is generated automatically by Android build tools, and is placed into the gen folder.

What is BuildConfig DEBUG in Android?

In recent versions of the Android Developer Tools (ADT) for Eclipse, there's a class called BuildConfig which is automatically generated by the build. This class is updated automatically by Android's build system (like the R class), and it contains a static final boolean called DEBUG, which is normally set to true.


1 Answers

BuildConfig.java is generated automatically by Android build tools, and is placed into the gen folder.

like image 198
Miki Franko Avatar answered Nov 06 '22 20:11

Miki Franko