具有相同名称的Android摇篮模块 [英] Android gradle modules with the same name
问题描述
我的工作,使用以下依赖的Android项目:
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>
不过这种依赖性具有模块的javax 2定义/注射如下所示的摇篮依赖关系树:
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
当试图运行Android应用程序我得到的错误:
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'
这篇关于具有相同名称的Android摇篮模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!