Android dependency 'com.android.support:appcompat-v7' has different version for the compile (26.1...

Error:Execution failed for task ':app:preDebugBuild'.

Android dependency 'com.android.support:appcompat-v7' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

图片
解决

方法一:
在app的build.gradle中的dependencies里添加:

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

方法二:
将app的build.gradle中的dependencies里的

    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

换成之前不报错的版本,例如我之前不报错的版本为

    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

同步一下就可以了

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容