After IDEA detects and adds an alt facet to the module, it will start generating the gen folder in the usual place, but the maven-android-plugin generate its own file in the target directory.
You need to say that IDEA places the generated files in the same place where the maven-android-plugin creates them.
First, use the facet model parameters modulo and check the possibility of using the Maven target instead of generating it yourself:

Then go to the module settings and set the output path to the same as Maven, which is located in the target directory:

Delete the gen directories, Do mvn clean , to delete all unnecessary files.
source share