新建一个Project发现直接报错:
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.
build.gradle全貌:
究其原因和解决方案:
三种方法:
1.注释dependecies中androidTestImplementation中的代码:
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
2.在dependecies中添加如下代码:
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:26.1.0'
}
3.改下complieSdkVersion和v7版本到27和27.1.1