Exception in thread "main" java.net.UnknownHostException: services.gradle.org

geetha picture geetha · Jul 1, 2015 · Viewed 36.6k times · Source

I am getting the below error when executing gradle.bat. I have checked the URL path and it looks fine. The URL is defined like this in the wrapper properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip 

Here's the error message:

Downloading https://services.gradle.org/distributions/gradle-2.1-bin.zip
Exception in thread "main" java.net.UnknownHostException: services.gradle.org at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)

Could someone help me on this?

Answer

Chintan Desai picture Chintan Desai · Sep 28, 2015
  1. Go to "C:\Users\[yourusername]\.gradle\" folder (hidden folder - Go to folder option and enable show hidden files if folder is not showing up)

  2. Look for file "gradle.properties" if DOES NOT (most likely this would be the case) exists, Create it under "C:\Users\[yourusername]\.gradle\

  3. Copy and paste following code (More detail ... https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties ... look for "20.3 Accessing the web via proxy" for https and user/pwd variables)

systemProp.http.proxyHost=[PROXY SERVER] systemProp.http.proxyPort=[PROXY PORT]

  1. save and try again