Skip to content Skip to sidebar Skip to footer

Gradle Build Fails For Unknown Host Exception

I just installed a new version of Android Studio and am trying to create a project using the built in templates. My environment is: Windows 7, SP1, 64 bit In a secure domain envi

Solution 1:

The problem is in your gradle/wrapper/gradle_wrapper.properties file. I'm not sure how it happened, but you have an improper URL in there for the downloadable distribution of Gradle. Change that line from this:

distributionUrl=file://C:/Users/stuz/.gradle/wrapper/dists/gradle-1.10-all.zip

to this:

distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip

Solution 2:

This solution worked for me...

Find the file gradlew.bat on your project directory, in that file change DEFAULT_JVM_OPTS variable as below:

set DEFAULT_JVM_OPTS=-Dhttp.proxyHost=YOUR_HOST -Dhttp.proxyPort=PORT -Dhttp.proxyUser=USERNAME -Dhttp.proxyPassword=PASSWORD -Dhttps.proxyHost=YOUR_HOST -Dhttps.proxyPort=PORT -Dhttps.proxyUser=USERNAME -Dhttps.proxyPassword=PASSWORD

then run gradlew clean build.

Solution 3:

Check if you are on secure network - if that is the case than in your gradle/wrapper/gradle_wrapper.properties file

distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

this line have https in it which is refused by secure network. I changed to unsecure network and it started working for me.

Solution 4:

under you project folder go to : platforms/android/cordova/lib/builders/GradleBuilder.js find distributionUrl and Remove https with http and replace "services" with "downloads".

distributionUrl=http\://downloads.gradle.org/distributions/gradle-2.4-all.zip

Solution 5:

you need to use the windows style file URI to make it valid

Windows Reference for File URI

distributionUrl=file\:///C\:/Users/<your_path_separated_by_/_chars>/gradle-2.4-all.zip

Post a Comment for "Gradle Build Fails For Unknown Host Exception"