关于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.
这个错误困扰了两天,发现reburld之后只是暂时解决,重启工程后还是会出现,
解决办法
在app下的build.gradle文件中的dependences {}中添加如下代码:
androidTestCompile('com.android.support:support-annotations:26.1.0') {
force = true
}
终极办法在根目录添加亲测已经好使
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:26.1.0'
}
网友评论