这是我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
未找到的编译错误