Skip to content
Latchkey

Gradle "Could not resolve all files for configuration" - Fix in CI

Gradle could not assemble every file for a configuration (e.g. runtimeClasspath). At least one dependency in that configuration could not be downloaded or found, so the whole resolution fails.

What this error means

Resolution fails with Could not resolve all files for configuration ':module:runtimeClasspath' followed by Could not resolve/Could not download lines for the specific artifacts that failed.

gradle output
> Could not resolve all files for configuration ':app:runtimeClasspath'.
   > Could not resolve com.example:lib:2.3.1.
     Required by:
         project :app
      > Could not get resource 'https://repo.../lib-2.3.1.jar'.
         > Read timed out

Common causes

One dependency unreachable or missing

A single artifact that times out, 404s, or needs auth fails the entire configuration resolution - Gradle needs all files, not most of them.

Repository not declared or credentials missing

If the hosting repository is not in repositories {} (or its credentials are absent), that dependency cannot be fetched and resolution fails.

How to fix it

Identify the failing dependency

The nested "Could not resolve/download" lines name the exact artifact. Inspect its resolution path.

Terminal
./gradlew :app:dependencies --configuration runtimeClasspath
./gradlew :app:dependencyInsight --dependency com.example:lib

Declare the repo and credentials

Add the hosting repository (with auth if private) so the artifact resolves.

build.gradle.kts
repositories {
    mavenCentral()
    maven {
        url = uri("https://nexus.example.com/repository/maven-releases/")
        credentials {
            username = System.getenv("REPO_USER")
            password = System.getenv("REPO_TOKEN")
        }
    }
}

How to prevent it

  • Centralize repositories in settings.gradle dependencyResolutionManagement.
  • Cache ~/.gradle/caches keyed on build scripts and lockfiles.
  • Pull-through a single mirror so a public outage does not break resolution.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →