关于“ 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
但是并不解决问题,所以放弃
问题作者:百科