I am working on an Android project that uses the following dependency:
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.17</version>
</dependency>
However this dependency has 2 definitions of the module javax/inject as shown here in the gradle dependency tree:
+--- org.glassfish.jersey.core:jersey-client:2.17
| +--- org.glassfish.jersey.core:jersey-common:2.17
| | +--- org.glassfish.hk2:hk2-api:2.4.0-b10
| | | +--- javax.inject:javax.inject:1
| | +--- org.glassfish.hk2.external:javax.inject:2.4.0-b10
When attempting to run the Android application I get the error:
com.android.dex.DexException: Multiple dex files define L/javax/inject/Inject
I have tried excluding either of these modules but that does not work because the dependency relies on both of them to make method calls.
Are there any other solutions to resolve this conflict?
I am using gradle and had the same issue and solved it according to this answer
compile ('org.glassfish.jersey.containers:jersey-container-servlet:2.14'){
exclude module: 'javax.inject'
}
compile 'org.glassfish.hk2.external:javax.inject:2.4.0-b06'
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