Basically i have the following problem:
My app depends on A, which depends on com.google.android:support-v4:r7.
Which you can see in the dependecy:tree
[INFO] +- com.viewpagerindicator:library:apklib:2.4.1:compile
[INFO] | \- com.google.android:support-v4:jar:r7:compile
At a certain point my apps needed to access r11 of the support-v4 library.
[INFO] +- android.support:compatibility-v4:jar:11:compile
But as you know, android.support:compatibility-v4 and com.google.android:support-v4 are actually the same libraries. Only named differently to avoid confusion. I understand this decision, but this causes some problems.
As you can see the class is defined twice, logically because mvn doesnt know the difference.
[INFO] UNEXPECTED TOP-LEVEL EXCEPTION:
[INFO] java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/LoaderManager;
[INFO] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[INFO] at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
...
My current workaround is to exlcude the com.google.android:support-v4 lib:
<dependency>
<groupId>com.viewpagerindicator</groupId>
<artifactId>library</artifactId>
<version>2.4.1</version>
<type>apklib</type>
<!-- we need to exclude this because we use r11 and is called android.support from maven-android-sdk-deployer -->
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
</exclusion>
</exclusions>
</dependency>
But this is rather ugly. And my IDE shows errors anywherer because it doesnt know where to find class files anymore.
The point is: We need one naming system! Can't we agree with the ones in maven central?
I heard google is moving to gradle. Hope they will provided mvn libs too.