错误:任务 ':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.
编辑:以下摘自评论
以下是我的依赖项:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
}
最佳答案
基于documentation :
Both your app APK and its test APK share the same classpath. So, you can get a build error if both APKs depend on different versions of the same library.
所以解决办法是改变你的
com.android.support:appcompat-v7:26.1.0
到
com.android.support:appcompat-v7:27.1.1
关于android - 使用 android studio 3.0.1 创建新项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50086012/