【问题标题】:What is the difference between google() and mavenCentral() in project level gradle file in an android project?android项目中项目级gradle文件中的google()和mavenCentral()有什么区别?
【发布时间】:2021-08-23 03:19:34
【问题描述】:

在项目级别,android 项目的 Gradle 文件在存储库块中包含 google()ma​​venCentral()

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.0"
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我已阅读相关答案 Difference between google() and maven { url 'https://maven.google.com' },但它没有描述 ma​​venCentral()。该答案基于 google() 作为 maven { url 'https://maven.google.com' } 的替代品。但在我的情况下,google()ma​​venCentral() 都同时使用。

【问题讨论】:

标签: android maven android-studio android-gradle-plugin build.gradle


【解决方案1】:

它们是不同的 Maven 工件存储库,由不同的实体托管,具有不同的用途。

google() 是 Google 的官方 Maven 存储库,我们在其中托管 Google 第一方库。这包括 AndroidX 库、Jetpack Compose、Firebase、Play Services、Material 等。您可以在线浏览here 托管的内容。

Maven Central 由 Sonatype 托管,允许任何人将其项目的工件上传到它。您可以阅读有关如何在 here 那里发布并搜索存储库 here 的信息。

【讨论】:

    猜你喜欢
    • 2015-10-10
    • 2016-05-13
    • 2021-12-03
    • 2019-12-19
    • 2011-08-18
    • 1970-01-01
    • 1970-01-01
    • 2012-06-30
    • 1970-01-01
    相关资源
    最近更新 更多