AS报错Conflict with dependency 'com.android.support:support-annotations'

版权声明:本文出自朋永的博客,转载必须注明出处。 https://blog.csdn.net/VNanyesheshou/article/details/82220669

使用Android Studio 创建的新项目,出现一下错误

Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. 
> Resolved versions for app (26.1.0) and test app (27.1.1) differ.
> See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

两种解决方法

1 使用高版本

修改app模块build.gradle中support的版本。

implementation 'com.android.support:appcompat-v7:27.1.1'

2 使用低版本。

app模块build.gradle中添加如下配置

configurations.all {
    resolutionStrategy.force 'com.android.support:support-annotations:26.1.0'
}

猜你喜欢

转载自blog.csdn.net/VNanyesheshou/article/details/82220669