关于Android Studio报错Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file '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
// }
//}
2,在根目录下的build.gradle文件中增加如下配置:
allprojects {
repositories {
google()
//阿里云jcenter仓库
maven{ url 'https://maven.aliyun.com/repository/jcenter' }
maven {
url 'https://jitpack.io'
}
}
}
3,然后点击按钮“sync project with gradle files”即可正常