Gradle cannot download files from internet on a Debian Wheezy host

Hi,

I’m new to Gradle and my development host machine is running Debian Wheezy Linux. I tried to build some Android apps. When I run gradlew, I always get the following error:

Downloading https://services.gradle.org/distributions/gradle-2.2.1-all.zip

Exception in thread “main” java.lang.RuntimeException: java.net.UnknownHostException: downloads.gradle.org
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.net.UnknownHostException: downloads.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2662)
at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2584)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1770)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at org.gradle.wrapper.Download.downloadInternal(Download.java:59)
at org.gradle.wrapper.Download.download(Download.java:45)
at org.gradle.wrapper.Install$1.call(Install.java:60)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
… 3 more

However, when I run the same same build on the Windows 8.1, everything works.

For both Debian Wheeay and Windows 8.1 system, I use the same jdk1.8.0_65 (Oracle Sun-Java jdk 8u65 64-bit).

Since I did most of my development on Debian Linux, I want somebody help me to figure out what’s going wrong on my Linux host.

Thanks,

UnknownHostException seems to be pointing to a DNS problem, rather than a gradle one.

Is the name properly resolving ?

$ host downloads.gradle.org
downloads.gradle.org is an alias for d2ueg53gsd9z3m.cloudfront.net.
d2ueg53gsd9z3m.cloudfront.net has address 54.230.46.241

Can you download the file manually using wget ?

$ wget  https://services.gradle.org/distributions/gradle-2.2.1-all.zip

I remember a problem with java under debian some years ago, related to the net.ipv6.bindv6only sysctl set to 1, completely breaking networking in java ; but I think it was in squeeze and corrected since.

Hi Alex,

Thank you for your help!

I followed your suggestion and get the following output:

rw@debian-desktop-rw:~/tmp$ host downloads.gradle.org
downloads.gradle.org is an alias for d2ueg53gsd9z3m.cloudfront.net.
d2ueg53gsd9z3m.cloudfront.net has address 54.230.143.23

rw@debian-desktop-rw:~/tmp$ wget
https://services.gradle.org/distributions/gradle-2.2.1-all.zip
–2015-11-09 06:43:17–
https://services.gradle.org/distributions/gradle-2.2.1-all.zip
Resolving services.gradle.org (services.gradle.org)… 104.25.173.23,
104.25.172.23, 2400:cb00:2048:1::6819:ac17, …
Connecting to services.gradle.org (services.gradle.org)|104.25.173.23|:443…
connected.
HTTP request sent, awaiting response… 301 Moved Permanently
Location: https://downloads.gradle.org/distributions/gradle-2.2.1-all.zip
[following]
–2015-11-09 06:43:19–
https://downloads.gradle.org/distributions/gradle-2.2.1-all.zip
Resolving downloads.gradle.org (downloads.gradle.org)… failed: Name or
service not known.
wget: unable to resolve host address `downloads.gradle.org

rw@debian-desktop-rw:~/tmp$

It obviously something is wrong with Debian Wheezy. I will contact Debian
for solution.

Regards,

Ray