Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
这段话的大概意思就是:比起在 build.gradle(project)下配置,在 setting.gradle 下配置更合适,但是 build.gradle 却配置了 maven 。
在报错提示下,去查看project的build.gradle,发现配置了 maven,解决办法就是把 allprojects 闭包下的内容全部转移到 setting.gradle 配置文件中。
如下图:
把 allproject 闭包转移到 setting.gradle 之后,重新编译运行即可。