使用android studio 3.0.1创建新项目时出现错误 [英] Error While creating new project with android studio 3.0.1

查看:68
本文介绍了使用android studio 3.0.1创建新项目时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:任务':app:preDebugAndroidTestBuild'的执行失败.

Error:Execution failed for task ':app:preDebugAndroidTestBuild'.

在项目':app'中与依赖项'com.android.support:support-annotations'发生冲突.应用(26.1.0)和测试应用(27.1.1)的已解决版本不同.参见 https://d.android.com/r/tools/test-apk-dependency-conflicts.html 了解详情.

以下内容摘自评论

以下是我的依赖项:

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都依赖于同一库的不同版本,则会出现构建错误.

因此解决方法是更改​​您的

So the fix would be to change your

com.android.support:appcompat-v7:26.1.0

com.android.support:appcompat-v7:27.1.1

这篇关于使用android studio 3.0.1创建新项目时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆