go/androidx/library_snapshots
Add the following snippet to your build.gradle file, replacing buildId with a snapshot build ID.
allprojects { repositories { google() jcenter() maven { url 'https://androidx.dev/snapshots/builds/[buildId]/artifacts/repository' } } }
You must define dependencies on artifacts using the SNAPSHOT version suffix, for example:
dependencies { implementation "androidx.core:core:1.2.0-SNAPSHOT" }
If you want to use unreleased SNAPSHOT versions of androidx artifacts, you can find them on either our public-facing build server:
https://ci.android.com/builds/submitted/<build_id>/androidx_snapshot/latest
or on our slightly-more-convenient androidx.dev site:
https://androidx.dev/snapshots/builds/<build-id>/artifacts for a specific build ID
https://androidx.dev/snapshots/latest/artifacts for tip-of-tree snapshots
To browse build IDs, you can visit either androidx-main on ci.android.com or Snapshots on the androidx.dev site.
Note that if you are using androidx.dev, you may substitute latest for a build ID to use the last known good build.
To manually find the last known good build-id, you have several options.
Snapshots on androidx.dev only lists usable builds.
jqInstall jq:
sudo apt-get install jq
ID=`curl -s "https://ci.android.com/builds/branches/aosp-androidx-main/status.json" | jq ".targets[] | select(.ID==\"aosp-androidx-main.androidx_snapshot\") | .last_known_good_build"` \ && echo https://ci.android.com/builds/submitted/"${ID:1:-1}"/androidx_snapshot/latest/raw/repository/
Go to androidx-main on ci.android.com.
For androidx-snapshot target, wait for the green “last known good build” button to load and then click it to follow it to the build artifact URL.
To make these artifacts visible to Gradle, you need to add it as a repository:
allprojects { repositories { google() maven { // For all Jetpack libraries (including Compose) url 'https://androidx.dev/snapshots/builds/<build-id>/artifacts/repository' } } }
Note that the above requires you to know the build-id of the snapshots you want.
All artifacts in the snapshot repository are versioned as x.y.z-SNAPSHOT. So to use a snapshot artifact, the version in your build.gradle will need to be updated to androidx.<groupId>:<artifactId>:X.Y.Z-SNAPSHOT
For example, to use the core:core:1.2.0-SNAPSHOT snapshot, you would add the following to your build.gradle:
dependencies {
...
implementation("androidx.core:core:1.2.0-SNAPSHOT")
...
}