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.
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.
Using an IDE like Eclipse, IntelliJ, Studio, the class BuildConfig is auto generated in the gen folder.
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.
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。
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With