Skip to main content
All CollectionsKnowledge BaseAndroid
Intermittent connection/timeout issues when downloading Android dependencies
Intermittent connection/timeout issues when downloading Android dependencies
Updated over a week ago

Issue:

When Gradle attempts to download dependencies, you get intermittent timeout or connection errors.

Possible solutions:

There are numerous reasons why this can happen, and several potential solutions.

Limiting the Maximum Number of Gradle Workers

Connection issues might increase after upgrading to a more powerful machine. This is because Gradle uses the additional processor threads to download more dependencies simultaneously. This can result in rate limiting errors.

One workaround is to limit the number of threads Gradle can use by specifying the maximum number of workers.

If you are calling a Gradle task from a Script Step, add the following argument:

--max-workers=4

Alternatively, you can add the following to your gradle.properties file:

org.gradle.workers.max=(max # of worker processes)

Retrying Failed Connections

Some dependencies from third parties may be using unstable hosting. In these instances, retrying a failed download can sometimes resolve the issue and keep the build from failing.

To have Maven retry connections, add the following to your gradle.properties file:

maven.wagon.http.retryHandler.count = 5

Committing Dependencies to Source Control

We highly recommend committing dependencies to your repository. Not only does this help with stability, but it dramatically decreases build times as well.

Additional information:

Did this answer your question?