This dependency gives me two versions of one jar. How do I fix this?
android, gradle, java, jersey, maven
Solution
It appears that you have a dependency tree akin
project
|--- org.glassfish.jersey.media:jersey-media-moxy:2.0
| \--- *:javax.inject:1
\--- *:javax.inject:2.3.0-b05
Where * is the group, which I suspect may be different from those two.
Try getting an idea of how your dependencies are being grabbed by using the dependency task
gradle dependency
Should you need to exclude a dependency enter it in the tag, similar to the below example
compile('org.hibernate:hibernate:3.1') {
//excluding a particular transitive dependency:
exclude module: 'cglib' //by artifact name
exclude group: 'org.jmock' //by group
exclude group: 'org.unwanted', module: 'iAmBuggy' //by both name and group
}
Problem
I'm using Gradle for my project. One of the dependencies I have specified in my build.gradle is `compile 'org.glassfish.jersey.media:jersey-media-moxy:2.0'` This works fine on a normal Java application, however when I try to build it on Android I get: When looking at which libraries are referenced, it's clear that there's both `javax.inject-2.3.0-b05.jar` and `javax.inject-1.jar`, which I found are added by the dependency above. I'm guessing that this 'duplicate' jar is what causes the build error. How do I go around this? Why does the dependency include two of the same jar? Is there a way to either make the Android version build with these two jars or to remove one of these jars?