Android 最新的AndroidStudio引入依赖失败如何解决?如:Failed to resolve:xxxx
错误信息:
在引入依赖时报错:Failed to resolve: xxx.xxxx:1.1.0
解决方案:
需要修改maven库的代理,否则就需要翻墙编译
新的AndroidStudio版本比较坑,修改代理的位置发生了变化:
最新变化:
修改settings.gradle文件(注意:不是以前的build.gradle)
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven { allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/repositories/google' }
maven { allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
maven { allowInsecureProtocol = true
url "https://jitpack.io" }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/repositories/google' }
maven { allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
maven { allowInsecureProtocol = true
url "https://jitpack.io" }
}
}
rootProject.name = "xxxxx"
include ':app'
重新编译即可
更多相关问题解决:
_______________________________________________________________________
如果您感觉文章有用的话,麻烦点个赞吧! 如果您发现文章有任何错误或建议,请评论区留言或者私信! 深海谢过各位的支持,一起加油!
原文地址:https://blog.csdn.net/qq_39731011/article/details/143769395
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!