与项目’:app’中的依赖’com.android.support:support-annotat
我是Android App Development的新手.当我尝试创建一个新项目时,Android Project …弹出以下消息..
错误:任务’:app:preDebugAndroidTestBuild’的执行失败.
这是我项目的截图 我也尝试将此代码添加到我的依赖项中..
根据您的截图,我发现了两个有效的解决方案
第一个解决方案:在此行添加gradle模块的依赖项 compile 'com.android.support:support-annotations:27.1.1' 并同步你的项目 注意:如果您使用Android studio 3更改编译实现 第二种解决方案:配置文档https://developer.android.com/studio/build/gradle-tips.html#configure-project-wide-properties中的项目范围属性 在project gradle中添加以下行: // This block encapsulates custom properties and makes them available to all // modules in the project. ext { // The following are only a few examples of the types of properties you can define. compileSdkVersion = 26 // You can also use this to specify versions for dependencies. Having consistent // versions between modules can avoid behavior conflicts. supportLibVersion = "27.1.1" } 然后访问此部分,将compileSdkVersionline更改为 compileSdkVersion rootProject.ext.compileSdkVersion 并在依赖项部分更改导入的库如下所示: compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 并同步你的项目 注意:如果您使用Android studio 3更改编译实现 对于编译和实现之间的区别,请看这个 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |