Android "Could not resolve com.android.tools.build:gradle" in CI
Gradle cannot fetch the Android Gradle plugin. Either the google() repository is missing, the AGP version does not exist, or the fetch failed.
What this error means
The build fails with Could not resolve com.android.tools.build:gradle:X. AGP is hosted in the Google Maven repo, which must be declared and reachable.
Could not resolve com.android.tools.build:gradle:8.5.0.
Required by:
project : > project :buildSrcCommon causes
google() repository not declared
AGP lives in Google Maven; without google() in the plugin/dependency repositories it cannot be found.
Nonexistent AGP version or transient fetch failure
A typo in the version, or a temporary network or registry blip while fetching from Google Maven.
How to fix it
Declare google() and a valid AGP version
- Add google() to the plugin management or repositories block.
- Use an AGP version that exists in Google Maven.
pluginManagement {
repositories {
google()
mavenCentral()
}
}Re-run if the fetch itself failed
A valid version that fails to download is usually transient. On Latchkey managed runners, self-healing auto-retries transient registry fetches so a one-off Google Maven blip does not fail the job.
How to prevent it
- Pin AGP to a real version, keep google() declared, and cache the Gradle dependency directory to reduce network fetches.