The Gradle wrapper cannot download its distribution (services.gradle.org unreachable)
Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-8.x-bin.zip'.Short answer
The wrapper must download Gradle once before it can build. It fails when the machine cannot reach services.gradle.org, when a proxy is not configured for Java, or when distributionUrl points at a version that no longer exists. Read the cause line, then fix the proxy or regenerate the wrapper.
Fix it fast
1Find out which cause you have
Open the URL from distributionUrl in a terminal. If the download starts, the network is fine and the wrapper settings are the problem.
grep distributionUrl gradle/wrapper/gradle-wrapper.properties curl -I https://services.gradle.org/distributions/gradle-9.9.1-bin.zip2Match what you see, then jump to its fix
- 1
Unknown host services.gradle.org, while a browser on the same machine opens the pageJava has no proxy settings, but the network needs oneFix - 2
HTTP 403 or 404 for the URL, or a very old version such as gradle-2.1 in the filedistributionUrl points at a version or path that is wrongFix - 3
The failure is random, and the same URL works from curlThe connection drops during a large downloadFix
- 1
What does the error look like?
Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-8.x-bin.zip'.Unknown host services.gradle.org. You may need to adjust the proxy settings in Gradle.Server returned HTTP response code: 403 for URL
Cause 1 of 3
Java has no proxy settings, but the network needs one
1Check
The wrapper applies systemProp entries from gradle.properties, read from the project root and from the Gradle user home, as JVM system properties before it downloads.
cat ~/.gradle/gradle.properties2Fix
Add the proxy for both http and https to gradle.properties in the Gradle user home, then list hosts that must bypass it.
systemProp.http.proxyHost=proxy.example.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=proxy.example.com
systemProp.https.proxyPort=8080
systemProp.http.nonProxyHosts=localhost|*.example.internal3Verify
Run the wrapper again. The download starts and the version prints.
./gradlew --versionConfirmed by github.com
Cause 2 of 3
distributionUrl points at a version or path that is wrong
1Check
A copied project can carry a version that is too old for your JDK, or a hand-edited URL with a typo. Since Gradle 9.0 the file needs the full X.Y.Z version.
cat gradle/wrapper/gradle-wrapper.properties2Fix
Regenerate the file with the wrapper task for a version your build needs. Run it twice to refresh the scripts and the wrapper jar.
./gradlew wrapper --gradle-version 9.9.1
./gradlew wrapper3Verify
The properties file shows the new URL and the build starts.
./gradlew --versionConfirmed by docs.gradle.org
Cause 3 of 3
The connection drops during a large download
1Check
The wrapper downloads the whole zip on the first run only. A slow or unstable link can break it halfway.
curl -L -o /dev/null -w '%{speed_download}\n' https://services.gradle.org/distributions/gradle-9.9.1-bin.zip2Fix
Ask the wrapper to retry, with a growing delay between tries.
# gradle/wrapper/gradle-wrapper.properties
retries=3
retryBackOffMs=10003Verify
Run the wrapper on the weak connection again.
./gradlew --versionConfirmed by docs.gradle.org
How do I stop it coming back?
- Keep proxy settings in the Gradle user home so they follow you across projects.
- Update the wrapper with the wrapper task instead of editing the URL by hand.
- Cache the Gradle user home on CI so the distribution downloads once.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
Gradle cannot trust the HTTPS certificate of a repository (PKIX path building failed)
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
The JDK that runs Gradle does not trust the certificate chain it received.
2 causes, each with a fixMobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fixMobile apps
adb tcpip 5555 fails because no device is found
adb: more than one device/emulator
adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.
4 causes, each with a fixMobile apps
The Android Emulator says /dev/kvm is not found
KVM acceleration can NOT be used
The emulator wants a hypervisor and cannot find one.
4 causes, each with a fix