Home > Mobile >  Gradle wrapper times out when using a proxy
Gradle wrapper times out when using a proxy

Time:11-03

This question is specifically about the Gradle wrapper and not a full Gradle installation.

My company forces me to use a proxy to access many urls, and all it usually takes to fix timeout problems is to configure whatever is trying to access said urls to use the proxy, after which I get a certificate verification error and I have to also add the sites' SSL certificates to Java's keystore (take change the pesky timeouts

Then you replace the gradle-wrapper.jar you were using and try again.

Once the wrapper manages to download the "dist" the first time, you might not run into this problem anymore even with the original jar.

If you do get a timeout again after that first time, then this is what you have to do to make sure that the modified gradle-wrapper.jar is used instead of the original, for example by IDEs when creating new projects:

  • go to %userprofile%\.gradle\wrapper\dists\gradle-<version>-bin\<folder with a random-looking name>\gradle-<version>\lib
    For example in my case it was:
    C:\Users\username\.gradle\wrapper\dists\gradle-7.4.2-bin\48ivgl02cpt2ed3fh9dbalvx8\gradle-7.4.2\lib

  • open the gradle-wrapper-<version>.jar file

  • replace the gradle-wrapper.jar that's inside it with the modified one.

Yes, it's a jar containing another similarly-named jar. Don't replace the outer one with your modified jar.

enter image description here

  • Related