1. 程式人生 > >Android studio Error:Execution failed for task ':app:preDebugAndroidTestBuild'錯誤的解決辦法

Android studio Error:Execution failed for task ':app:preDebugAndroidTestBuild'錯誤的解決辦法

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 

解決辦法:在 build.gradle 新增

?

1

2

3

4

5

6

7

8

9

10

11

android {

 ...

}

 

configurations.all {

 resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'

}

 

dependencies {

 ...

}

轉自:https://www.2cto.com/kf/201807/760034.html