为什么 build.gradle 中导入存储库的顺序决定了项目的成败?
Why does the order of imported repositories in build.gradle make or break the project?
请解释为什么第一个代码给我同步错误而第二个没有。
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 Gradle’s resolution mechanism.
请解释为什么第一个代码给我同步错误而第二个没有。
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 Gradle’s resolution mechanism.