关于android studio 出现Error:Execution failed for task ':app:preDebugAndroidTestBuild'. 的解决办法

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.

 

打开 AS 就显示这个问题 解决方法很简单;

在app 的build.gradle 里面添加如下代码解决问题

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

关于android studio 出现Error:Execution failed for task ':app:preDebugAndroidTestBuild'. 的解决办法