Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versi

  1. 将某library作为一个module导入集成时,报错
    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.
在这里插入图片描述

问题分析:由于com.android.support:support-annotations的版本不一致导致,可强制使用某一版本。
解决方案:
在您工程的app的build.gradle中的dependences {}中添加

androidTestCompile(‘com.android.support:support-annotations:26.1.0’) {
force = true
}

添加后dependences中结构类似:
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versi_第1张图片

你可能感兴趣的:(Android,androidstudio,annotations)