I have an android project setup using the maven-android plugin. This plugin adheres to maven output folders for the location of the R.java
file (i.e. target/generated-sources/r
).
However, when using this project in Eclipse, I can't configure aapt to rely on that folder.
Even if I manually go into the project properties and set up the folders manually, the ADT plugin goes in and resets just some of the settings (i.e. adds the /gen
folder back as a source folder, and restores the output folder to /bin/classes
instead of /target/classes
), while leaving the maven /target/generated-sources/r
folder and breaking the build of the project.
I would like to use the default Maven folder structure with the Eclipse ADT. Any ideas on how I can do this?
Thanks
Responding to the comments:
/gen
, Eclipse is failing to compile if there still exists an R.java under target/generated-sources/r
due to duplicated class definitions.Unfortunately, the Android Connector for M2E does not support moving generated folders like the ADT gen folder to other directories. This is a restriction of the ADT, although there is a ticket to explore a way around this restriction:
https://github.com/rgladwell/m2e-android/issues/68
If you'd like to stay updated, please comment on this ticket.
This seems to be working for me:
Let the ADT keep gen as a source folder, but change the output folder for that source folder to be /target/classes
.
I can build in both eclipse and using maven from the command line, and I don't get duplicate R class problems in either case. Essentially, Eclipse generates the R.java
file in /gen
, while maven generates it in /target/generated-sources/r
, but both builds put the R.class
file under /target/classes.
Note: at one point I had added /gen
as an additional source directory in my pom.xml
using build-helper-maven-plugin
, and I had to remove that.
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