Androidx,如何知道依赖格式/字符串

kol*_*boc 2 android gradle androidx

好的,我知道我可以在那里找到所有 androidx 库:AndroidX 库,但请有人解释我如何弄清楚如何在我的依赖项中正确命名它们(使用 Gradle 作为构建系统的 Android 项目)。我真的很感激一些通用的方案,如前例。支持库,它们曾经包含依赖项的 gradle 配置,现在这些都没有了,所以我怀疑我遗漏了一些非常简单的东西,这些东西应该适用于提供的链接中列出的所有库。

我尝试使用调色板发布

implementation 'androidx.palette.graphics:1.0.0'
Run Code Online (Sandbox Code Playgroud)

结果ERROR: Failed to resolve: androidx.palette.graphics:1.0.0:
提前致谢。

ian*_*ake 9

You can go to maven.google.com and see all of the artifacts. There, you can see the artifact group (the top level) is androidx.palette and the artifact name (the second level) is palette, which means the whole implementation line is

implementation 'androidx.palette:palette:1.0.0'
Run Code Online (Sandbox Code Playgroud)

Note the group:name:version syntax. This is common across all artifacts everywhere, including across all AndroidX artifacts.


jep*_*bio 5

您可以在这里找到 Android KTX 的信息,它是 Android Jetpack 和其他 Android 库中包含的一组 Kotlin 扩展: https://developer.android.com/kotlin/ktx

要使用调色板模块,请将以下内容添加到应用程序的build.gradle文件中:

dependencies {
    implementation "androidx.palette:palette-ktx:1.0.0"
}
Run Code Online (Sandbox Code Playgroud)