I have an Android project with a dependency to a apklib project. In the apklib project a R.java file will be generated and packed into the result apklib file. The Android project unzip it via android plugin and rebuild all code. In consequence of this there are a doublicate R file compilation error cause the plugin try to rebuild the R file of the apklib project resources in the Android project.
What is the problem? Here my snippets from the pom files:
<?xml version="1.0"?>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
...apk
com.jayway.maven.plugins.android.generation2
android-maven-plugin
3.8.0
true
${project.basedir}/AndroidManifest.xml
${project.basedir}/assets
${project.basedir}/res
${project.basedir}/gen
15
${android.sdk.path}
false
MyAndroid
usb
true
true
...
com.google.android
android
4.0.1.2
provided
com.google.android
android-test
4.0.1.2
test
com.google.android
support-v4
r12
...
my.group.id
artifact
1.0.0-SNAPSHOT
apklib
<?xml version="1.0"?>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">apklib
com.jayway.maven.plugins.android.generation2
android-maven-plugin
3.8.0
true
${project.basedir}/AndroidManifest.xml
${project.basedir}/assets
${project.basedir}/res
${project.basedir}/gen
15
${android.sdk.path}
...
com.google.android
android
4.0.1.2
provided
com.google.android
android-test
4.0.1.2
test
com.google.android
support-v4
r12
...
The problem is that the in the apklib generated R.java file is copied into the gen folder of the Android project by the aapt tool (V. 19). I work with Windows platform, maven 3.1.1 and the android maven plugin 3.8.0 on both projects.