Androidx, how to know dependency format/string

Viewed 2920

Ok I got that I can found all androidx libraries there:AndroidX libraries, but please can someone explain how can I figure out how to properly name them in my dependencies (Android project with Gradle as build system). I would really appreciate some generic scheme for that, as in ex. support libraries, they used to include gradle config for dependencies, now these are gone so I suspect I am missing something very simple that should be applicable to all libraries listed in the link provided.

My attempt with pallete palette releases:

implementation 'androidx.palette.graphics:1.0.0'

Resulting in ERROR: Failed to resolve: androidx.palette.graphics:1.0.0:
Thanks in advance.

2 Answers

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'

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

Here you can find info for the Android KTX which is a set of Kotlin extensions that are included with Android Jetpack and other Android libraries: https://developer.android.com/kotlin/ktx

To use the palete module, add the following to your app's build.gradle file:

dependencies {
    implementation "androidx.palette:palette-ktx:1.0.0"
}
Related