错误信息:
在引入依赖时报错: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'
重新编译即可
更多相关问题解决:
Android 项目编译报错或异常,有多少解决方案?_cocos 构建apk 构建成功,编译失败-CSDN博客文章浏览阅读3.9k次,点赞4次,收藏13次。当遇到Android项目出现大面积错误时,可以尝试通过重启Android Studio、清理和重建项目、检查环境配置、调整依赖库等步骤来解决问题。检查内容包括SDK和NDK配置、Gradle与JDK设置,以及使用阿里云镜像仓库解决网络限制。此外,注意Kotlin版本匹配和依赖关键字的正确使用,如implementation与api的区别。https://zhaoxinghai.blog.csdn.net/article/details/123205995
_______________________________________________________________________
如果您感觉文章有用的话,麻烦点个赞吧! 如果您发现文章有任何错误或建议,请评论区留言或者私信! 深海谢过各位的支持,一起加油!