Build was configured to prefer settings repositories over project repositories

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 配置文件中。

Build was configured to prefer settings repositories over project repositories_第1张图片

如下图:

Build was configured to prefer settings repositories over project repositories_第2张图片

把 allproject 闭包转移到 setting.gradle 之后,重新编译运行即可。

你可能感兴趣的:(maven,gradle,android)