其他分享
首页 > 其他分享> > android – 为什么build.gradle中导入的存储库的顺序会成功还是破坏项目?

android – 为什么build.gradle中导入的存储库的顺序会成功还是破坏项目?

作者:互联网

请解释为什么第一个代码给我同步错误而第二个代码没有.

allprojects {
    repositories {
        jcenter()
        google()
    }
}

Failed to resolve: play-services-base
Open File

Failed to resolve: play-services-tasks
Open File

更改存储库顺序同步就好了:

allprojects {
    repositories {
        google()
        jcenter()
    }
}

有人可以给我一个理由或教育猜测为什么会发生这种情况?

解决方法:

这个文档可能对您有用:

https://docs.gradle.org/current/userguide/declaring_repositories.html

从底部开始,它提到:

Note: The order of declaration determines how Gradle will check for dependencies at runtime. If Gradle finds a module descriptor in a
particular repository, it will attempt to download all of the
artifacts for that module from the same repository. You can learn more
about the inner workings of 07001.

标签:android,android-gradle,build-gradle,google-api,jcenter
来源: https://codeday.me/bug/20190910/1800797.html