AS 解决support-annotations版本冲突

一个Gradle support-annotations版本冲突的坑,报错如下:

  • What went wrong:
    Execution failed for task ‘:testAppForMobile:lint’.

Could not resolve all artifacts for configuration ‘:testAppForMobile:debugAndroidTestRuntimeClasspath’.
Could not resolve com.android.support:support-annotations:26.0.0.
Required by:
project :testAppForMobile
Cannot find a version of ‘com.android.support:support-annotations’ that satisfies the version constraints:
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support.test🏃1.0.2’ --> ‘com.android.support:support-annotations:27.1.1’
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:appcompat-v7:26.0.0’ --> ‘com.android.support:support-annotations:26.0.0’
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support.test🏃1.0.2’ --> ‘com.android.support.test:monitor:1.0.2’ --> ‘com.android.support:support-annotations:27.1.1’
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support.test.espresso:espresso-core:3.0.2’ --> ‘com.android.support.test🏃1.0.2’ --> ‘com.android.support:support-annotations:27.1.1’
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:leanback-v17:26.0.0’ --> ‘com.android.support:support-compat:26.0.0’ --> ‘com.android.support:support-annotations:26.0.0’
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:leanback-v17:26.0.0’ --> ‘com.android.support:support-core-ui:26.0.0’ --> ‘com.android.support:support-annotations:26.0.0’
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:leanback-v17:26.0.0’ --> ‘com.android.support:support-media-compat:26.0.0’ --> ‘com.android.support:support-annotations:26.0.0’
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:leanback-v17:26.0.0’ --> ‘com.android.support:recyclerview-v7:26.0.0’ --> ‘com.android.support:support-annotations:26.0.0’
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:appcompat-v7:26.0.0’ --> ‘com.android.support:support-vector-drawable:26.0.0’ --> ‘com.android.support:support-annotations:26.0.0’
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:leanback-v17:26.0.0’ --> ‘com.android.support:support-fragment:26.0.0’ --> ‘com.android.support:support-core-utils:26.0.0’ --> ‘com.android.support:support-annotations:26.0.0’
Constraint path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:support-annotations’ strictly ‘26.0.0’ because of the following reason: debugRuntimeClasspath uses version 26.0.0
Constraint path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:support-annotations’ strictly ‘26.0.0’ because of the following reason: debugRuntimeClasspath uses version 26.0.0

搞了半天,一直说是找不到com.android.support:support-annotations:26.0.0.
Dependency path ‘Stb_Application:testAppForMobile:unspecified’ --> ‘com.android.support:appcompat-v7:26.0.0’ --> 'com.android.support:support-annotations:26.0.0’这里又说不确定是哪个版本的,原来是依赖的项目里的jar包用的是不同版本的,解决的办法就是在依赖的模块和自己的模块中加入
configurations.all {
resolutionStrategy.force ‘com.android.support:support-annotations:26.0.0’
},强制使用这个版本的,就解决了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值