19

so currently at work I face the problem, that I cannot build projects, which use global dependencies. We use an auto-config proxy script, which I already set in the File->Settings->Appearance & Behaviour->System Settings->HTTP Proxy and tested with the Check Connection-function.

The check connection function is working for any arbitrary html and also for the needed gradle-file (jcenter.bintray.com/com/android/tools/build/gradle/2.0.0/gradle-2.1.0-javadoc.jar).

For solutions I already tried to:

  • set the Proxy Information into the gradle.properties
  • tried to set http and/or https proxy settings

    * systemProp.http(s).proxyHost=linktoproxyconfig.org  
    * systemProp.http(s).proxyPort=xxxx                 
    * systemProp.http(s).proxyUser=xxxx            
    * systemProp.http(s).proxyPassword=xxxx
    
  • changing the repository direction (jcenter() vs. jcenter{url http://jcenter.bintray.com}

I am aware of the fact, that one can work offline, downloading the gradle locally. But to prevent the additional maintenance of gradle versions on different machines I would like to restrain from the work offline option.

Edit: Maybe I should also add the error message:
Gradle sync failed: Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.

I would be most grateful if someone has an idea about a solution.

Robin Green
  • 32,079
  • 16
  • 104
  • 187
sasuchi
  • 191
  • 1
  • 1
  • 7
  • Just in case that proxyHost you use, has http/https prefix, remove them! https://stackoverflow.com/questions/44109325/gradle-installation-having-a-proxy-issue/44260798#answer-44260797 – oikonomopo May 30 '17 at 11:43
  • Hi, I am exactly in the same shoes. How did you resolve this issue – Sandeep May 31 '18 at 01:23

4 Answers4

21

IntelliJ IDEA 2017.3 does not seem to respect the proxy options for downloading Gradle. So add the proxy options to both gradle.properties and gradle-wrapper.properties, and then run ./gradlew in a terminal. This will download Gradle. After that, IntelliJ will work.

Robin Green
  • 32,079
  • 16
  • 104
  • 187
1

I am facing the same problem because I using the proxy in Windows 10. Going to set the auto dectect the proxy fixed the connection timeout problem:

enter image description here

version IntelliJ IDEA 2022.1.2 (Community Edition).

Dolphin
  • 29,069
  • 61
  • 260
  • 539
0

It also happend to me and the problem was that Gradle installation was wrong. I added a GRADLE_HOME environment variable and appended %GRADLE_HOME%/bin to PATH. I restarted the IDE and it worked! :)

Source: https://docs.gradle.org/current/userguide/installation.html#sec:installation_environment_variables

Julieta
  • 407
  • 2
  • 8
0

Another possible caveat: Check if your environment variables for GRADLE_USER_HOME is set. Gradle will look for the gradle.properties in this directory.