Java – gradle build failed due to an unknown host exception
•
Android
I just installed a new version of Android studio and tried to create a project using the built-in template
My environment is Windows 7, SP1, 64 bit. In a secure domain environment, I am the domain administrator on my computer
This is what I see:
C:\Users\stuz\AndroidStudioProjects\test>gradlew compileDebug --stacktrace
Downloading file://C:/Users/stuz/.gradle/wrapper/dists/gradle-1.10-all.zip
Exception in thread "main" java.lang.RuntimeException: java.net.UnkNownHostExcep
tion: C
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.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: C
at java.net.AbstractPlainSocketImpl.connect(UnkNown Source)
at java.net.PlainSocketImpl.connect(UnkNown Source)
at java.net.socket.connect(UnkNown Source)
at java.net.socket.connect(UnkNown Source)
at sun.net.ftp.impl.FtpClient.doConnect(UnkNown Source)
at sun.net.ftp.impl.FtpClient.tryConnect(UnkNown Source)
at sun.net.ftp.impl.FtpClient.connect(UnkNown Source)
at sun.net.ftp.impl.FtpClient.connect(UnkNown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(UnkNown Source)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(UnkNown Sour
ce)
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(ExclusiveFileAcc
essManager.java:65)
Thanks for your help.
resolvent:
The problem is gradle / wrapper / gradle_ In the wrapper.properties file. I'm not sure how it happened, but you have an incorrect URL for the downloadable distribution of gradle. Change this line:
distributionUrl=file://C:/Users/stuz/.gradle/wrapper/dists/gradle-1.10-all.zip
In this regard:
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码