【发布时间】:2015-09-04 06:37:14
【问题描述】:
这是我的build.gradle 的一部分有冲突:
...
dependencies {
classpath 'com.android.tools.build:gradle:1.1.1'
}
...
testCompile( 'com.squareup.assertj:assertj-android:1.0.0' )
...
我在日志中看到的问题:
WARNING: Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (21.0.3) and test app (20.0.0) differ.
显然它从类路径中删除了冲突的依赖关系。我不确定是gradle 还是android gradle 插件。
我已经试过了:
testCompile( 'com.squareup.assertj:assertj-android:1.0.0' ) {
exclude group: 'com.android.support', module: 'support-annotations'
}
但我仍然有编译错误,因此排除了依赖关系。
我已经试过了:
configurations.all {
resolutionStrategy {
// fail eagerly on version conflict (includes transitive dependencies)
// e.g. multiple different versions of the same dependency (group and name are equal)
failOnVersionConflict()
// force certain versions of dependencies (including transitive)
// *append new forced modules:
force 'com.android.support:support-annotations:21.0.3'
// *replace existing forced modules with new ones:
forcedModules = ['com.android.support:support-annotations:21.0.3']
}
}
但看起来它不起作用,因为它在第一次冲突时没有失败,而且我仍然有编译错误。
你有什么建议?
更新删除依赖是什么意思 - 我看到很多编译错误 assertj not found
【问题讨论】:
标签: android gradle android-gradle-plugin assertj android-assertj