Dan*_*rov 5 android gradle android-gradle-plugin
我正在尝试编译其依赖树看起来像的模块
+--- com.squareup.burst:burst-junit4:1.0.2
| +--- com.squareup.burst:burst:1.0.2
| \--- junit:junit:4.11 -> 4.12
| \--- org.hamcrest:hamcrest-core:1.3
+--- com.android.support.test.espresso:espresso-core:2.0
| +--- com.squareup:javawriter:2.1.1
| +--- org.hamcrest:hamcrest-integration:1.1
| | \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
| +--- org.hamcrest:hamcrest-library:1.1
| | \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
| +--- com.android.support.test.espresso:espresso-idling-resource:2.0
| +--- com.android.support.test:testing-support-lib:0.1
| | \--- junit:junit-dep:4.10
| | \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
| +--- com.google.code.findbugs:jsr305:2.0.1
| +--- javax.annotation:javax.annotation-api:1.2
| \--- org.hamcrest:hamcrest-core:1.1 -> 1.3
...
Run Code Online (Sandbox Code Playgroud)
正如您所看到的那样存在hamcrest-core
版本冲突,但gradle似乎认识到冲突并应用其默认的"最新版本"策略,这正是我想要的.
但是,在尝试运行时assembleDebugTest
(手动或通过Android Studio),我得到了
com.android.dex.DexException: Multiple dex files define Lorg/hamcrest/MatcherAssert;
Run Code Online (Sandbox Code Playgroud)
类似问题的一些答案暗示exclude
了不需要的罐子,但我遇到了一堆类似的冲突,而且它有点失控.
为什么gradle的默认冲突策略不会自动删除旧jar?android gradle插件是否会抑制该功能?
一些挖后,似乎问题是我的依赖关系树包含hamcrest-core
1.3和hamcrest-integration
1.1,并MatcherAssert
从被转移hamcrest-integration
到hamcrest-core
这些版本之间.
因此,gradle正在记录冲突解决方案; 不同的模块之间只有一个我没想到的冲突.
所有三个hamcrest模块的强制1.3都解决了这个问题.
归档时间: |
|
查看次数: |
4847 次 |
最近记录: |