经常在新建项目或者导入别的项目时遇到这个问题,真是烦死大爷了,记录一下。
Error:FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (27.0.2) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
解决方案:在app级别目录下(非project目录)的build.gradle中添加:
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}