使用android studio 3.0.1创建新项目时出错

使用android studio 3.0.1创建新项目时出错,android,Android,错误:任务“:app:preDebugAndroidTestBuild”的执行失败 与依赖项“com.android.support”冲突:支持注释“在项目中”:应用程序。应用程序(26.1.0)和测试应用程序(27.1.1)的解析版本不同。有关详细信息,请参阅 编辑:以下内容摘自评论 以下是我的依赖项: dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation

错误:任务“:app:preDebugAndroidTestBuild”的执行失败

与依赖项“com.android.support”冲突:支持注释“在项目中”:应用程序。应用程序(26.1.0)和测试应用程序(27.1.1)的解析版本不同。有关详细信息,请参阅

编辑:以下内容摘自评论

以下是我的依赖项:

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' 
}
根据:

你的应用程序APK和它的测试APK共享相同的类路径。因此,如果两个APK依赖于同一库的不同版本,则可能会出现生成错误。

所以解决办法是改变你的

com.android.support:appcompat-v7:26.1.0


com.android.support:appcompat-v7:27.1.1

您也可以选择这个

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
而不是这个,

androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1'

你能用build.gradle更新你的问题吗?依赖项{implementation fileTree(dir:'libs',include:['*.jar']))实现'com.android.support:appcompat-v7:26.1.0'实现'com.android.support.constraint:constraint布局:1.1.0'测试实现'junit:junit:4.12'androidTestImplementation'com.android.support.test:runner:1.0.2'androidTestImplementation'com.android.support.test.浓缩咖啡:浓缩咖啡核心:3.0.2'androidTestImplementation'com.android.support:support annotations:27.1.1'}这些是我在应用程序中实现的应用程序级依赖项。我添加了上一个gradle androidTestImplementation'com.android.support:support annotations:27.1.1',但是错误没有解决。我已经回答了这个问题,你可以检查太好了!记住点击勾选按钮,这样它就被批准了,其他人也可以从中受益