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

Exception or error:

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.

How to solve:

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。

Leave a Reply

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