Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Android plugin: suppress generation of BuildConfig.java or change where it is written?

Tags:

I am trying to stop IntelliJ from putting generated files in my primary source folder. These generated .java files are interfering with glob rules that I use with other tools. (Think find -name '*.java'.)

For Android development, I appear to be able to customize the output directory for R.java and files generated from the AIDL compiler, but IntelliJ appears insistent on creating a gen/ directory and writing a BuildConfig.java file in my source tree. Is there anything that I can do to stop it?

I realize that normally, the gen/ folder is created alongside the src/ folder, but in my case, I am using something like:

<sourceFolder packagePrefix="com.example" />

so the gen/ directory that is created under com.example and looks like a new package (com.example.gen) whereas it is not.

like image 577
bolinfest Avatar asked Oct 24 '12 23:10

bolinfest


People also ask

What generates BuildConfig Java?

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 generated?

Using an IDE like Eclipse, IntelliJ, Studio, the class BuildConfig is auto generated in the gen folder.

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.


1 Answers

click File->Project Structure->Facets,you can here found your android app,click Generated sources here, now you can set Directory for generated files here。

like image 182
keepcleargas Avatar answered Oct 21 '22 14:10

keepcleargas