源文来自:https://blog.youkuaiyun.com/taoerchun/article/details/86004456
新建的android项目,出现 “Failed to resolve: com.android.support:appcompat-v7:27+” 的错误, 点击 Try Again 无效。
经百度,得知需要修改 build.gradle文件,allprojects -> repositories 中增加节点 maven,如下:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven{
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
解决Android项目依赖失败
本文解决了一个常见的Android项目构建问题,即“Failed to resolve: com.android.support:appcompat-v7:27+”的错误。通过修改build.gradle文件,在repositories中增加maven节点,指向Google的maven仓库,成功解决了依赖无法解析的问题。
5万+

被折叠的 条评论
为什么被折叠?



