Eug*_*nov 8 android gradle android-gradle-plugin assertj android-assertj
这是我的一部分build.gradle有冲突:
...
dependencies {
classpath 'com.android.tools.build:gradle:1.1.1'
}
...
testCompile( 'com.squareup.assertj:assertj-android:1.0.0' )
...
Run Code Online (Sandbox Code Playgroud)
我在日志中看到的问题:
WARNING: Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (21.0.3) and test app (20.0.0) differ.
Run Code Online (Sandbox Code Playgroud)
显然它从类路径中删除了冲突的依赖.我不确定它是插件gradle还是android gradle插件.
我接下来试过了:
testCompile( 'com.squareup.assertj:assertj-android:1.0.0' ) {
exclude group: 'com.android.support', module: 'support-annotations'
}
Run Code Online (Sandbox Code Playgroud)
但我仍然有编译错误,因此排除了依赖.
我接下来试过了:
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']
}
}
Run Code Online (Sandbox Code Playgroud)
但看起来它不起作用,因为它没有在第一次冲突失败,我仍然有编译错误.
你的建议是什么?
更新删除依赖是什么意思 - 我发现很多assertj未找到的编译错误
我遇到了同样的问题.这为我修好了:
testCompile('com.squareup.assertj:assertj-android:1.0.0'){
exclude group: 'com.android.support', module:'support-annotations'
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1497 次 |
| 最近记录: |