AS版本3.0.1新建项目报错Error:Execution failed for task ':app:preDebugAndroidTestBuild'。
具体报错信息如下;
从报错信息来看,问题出在这两个依赖上;
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
应该就是com.android.support:support-annotations这个依赖冲突了,在app和text app中版本不一致。
从查找的解决方案来看,思路应该就是将text app中的版本降到26.0.1,与app中的版本保持一致。
查到的解决办法有三种;
1;Build->Rebuild Project,临时解决,重新打开项目还是会报错。
2;在app下的build.gradle文件中的dependences {}中添加如下代码:
androidTestCompile('com.android.support:support-annotations:26.1.0') { force = true }
3;在app下的build.gradle文件中添加如下代码;
configurations.all { resolutionStrategy.force 'com.android.support:support-annotations:26.1.0' }
对于哪种方法的优劣暂时还不清楚;
参考;
前两种解决方案;
https://www.cnblogs.com/fqfzs/p/9117520.html
第三种解决方案
https://blog.****.net/wangzici/article/details/80140357
注;如果有任何其他问题,像侵权或建议等,请联系我,谢谢~