irpas技术客

Build was configured to prefer settings repositories over project repositories b

大大的周 4876

关于“ Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by build file 'app\build.gradle' ” 问题的解决方案

本人的原因:增加kotlin的兼容支持;当然还有其他原因导致,这里不细述;

有用解法步骤如下:

1,将setting.gradle文件的该配置注释掉:

//dependencyResolutionManagement { // repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) // repositories { // google() // mavenCentral() // jcenter() // Warning: this repository is going to shut down soon // maven { url 'https://jitpack.io' } // } //}

2,在根目录下的build.gradle文件中增加如下配置:

allprojects { repositories { google() mavenCentral() // jcenter() // Warning: this repository is going to shut down soon } }

3,然后点击按钮“sync project with gradle files”即可正常

注意:

1,也找了线上大多数的解决办法,例如这里的:android - Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle' - Stack Overflow

但是并不解决问题,所以放弃


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #build #was #configured #To #prefer #Settings #Repositories #over