Gradle "Could not resolve org.jetbrains.kotlin:kotlin-stdlib" in CI
The Kotlin plugin adds kotlin-stdlib for you. A "Could not resolve" error means Gradle cannot fetch the requested stdlib version: mavenCentral is missing from repositories, the runner has no network to it, or a forced version conflicts with the plugin version.
What this error means
Dependency resolution fails with "Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.9.25" (or a "Conflict(s) found for the following module") pointing at the stdlib.
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib:2.0.21.
Required by:
project :app
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib:2.0.21.
> No cached version available for offline modeCommon causes
The repository serving the stdlib is not declared
Without mavenCentral() (or an internal mirror) in repositories {}, Gradle has nowhere to fetch the stdlib on a clean CI runner.
A forced stdlib version conflicts with the plugin
A resolution rule or BOM forces a stdlib version different from what the Kotlin plugin expects, so Gradle cannot agree on one.
How to fix it
Declare the repository
- Ensure
mavenCentral()(or your mirror) is inrepositories {}. - Remove
--offlineif the runner has no populated cache. - Re-run resolution to fetch the stdlib.
repositories {
mavenCentral()
}Let the plugin manage the stdlib version
Do not force a stdlib version; align it with the Kotlin plugin so the two never conflict.
dependencies {
// no explicit kotlin-stdlib pin; the kotlin("jvm") plugin adds the matching version
}How to prevent it
- Keep a resolvable repository declared for every project in CI.
- Avoid forcing kotlin-stdlib; let the plugin choose the matching version.
- Cache the Gradle dependency cache so offline resolution has the stdlib available.