Android Studio Gradle Sync fails with SocketTimeoutException downloading Gradle 8.13


I am creating a new Android project in Android Studio on Windows, but Gradle Sync fails when Android Studio tries to download Gradle 8.13.

The error shown in Android Studio is:

Could not install Gradle distribution from

'https://services.gradle.org/distributions/gradle-8.13-bin.zip'.

Reason:

java.net.SocketTimeoutException: Connect timed out

My project is configured to use the Gradle wrapper.

I am using:

  • OS: Windows 11
  • Android Studio: Panda 1 | 2025.3.1 Patch 1
  • Gradle: 8.13
  • Gradle distribution: gradle-8.13-bin.zip
  • Gradle JDK: JetBrains Runtime 21.0.8

I also tested the connection from PowerShell:

Test-NetConnection services.gradle.org -Port 443

The result is:

ComputerName     : services.gradle.org
RemoteAddress    : 2606:4700:90d1:649e:fb43:4de:6810:4865
RemotePort       : 443
InterfaceAlias   : Ethernet 2
TcpTestSucceeded : True

So the domain is reachable from my system.

I also manually downloaded: gradle-8.13-bin.zip

from the Gradle website using Chrome, and the download completed successfully.

However, Android Studio still fails during Gradle Sync with:

java.net.SocketTimeoutException: Connect timed out

I have already checked Android Studio's Gradle settings and the project is using:

Distribution: Wrapper

Gradle JDK: C:\\Program Files\\Android\\Android Studio\\jbr

What could cause Android Studio/Gradle to timeout while downloading the distribution when the same URL is reachable from the browser and port 443 is reachable from PowerShell?

How can I configure Android Studio/Gradle to use the downloaded Gradle distribution or otherwise fix the Gradle Sync timeout?

0
Aug 11 at 11:37 AM
User AvatarShery221
#java#android#gradle

Accepted Answer

Android Studio's Gradle wrapper runs in a Java process that doesn't always pick up your system network configuration. Because the download timeout is hardcoded, you can't just bump it in gradle.properties.

Since you have the zip file already, I'd just point the wrapper at it. Change the distributionUrl in gradle/wrapper/gradle-wrapper.properties to this:

distributionUrl=file:///C:/Users/YourName/Downloads/gradle-8.13-bin.zip

Delete the partial downloads in %USERPROFILE%\.gradle\wrapper\dists and sync. So if it's a network issue specific to the JVM, this local path bypasses the download entirely.

To see the logs, you can run gradlew --debug from the project root. It'll use the same JDK Android Studio uses.

User AvatarStackTraceSeeker
Aug 12 at 4:04 AM
-1