Search code examples
androidmaven-2android-maven-plugin

Maven builds on Android project using a library project causing duplicate R class errors


I have an Android project that depends on an android library (apklib) project. The projects builds fine within Eclipse but my command line build using maven fails complaining of duplicate R class (the R class from my android library project).

Inside my target folder I have three subdirectories.

  1. classes : the compiled class files (as usual).
  2. generated-sources: the generated R.java for both the main project and the library project.
  3. unpack : the contents of my library project including the manifest, the resource xml files and the generated R.java file.

Is the presence and contents of the 'unpack' folder to be expected? The R.java file within it is causing the duplicate R class build failure.


Solution

  • I would suggest to use the latest version of the Android Maven Plugin (3.0.0) and look how the samples for apklib usage are set up. That will solve your problem.