线程“主”中的异常java.net.UnknownHostException:services.gradle.org [英] Exception in thread "main" java.net.UnknownHostException: services.gradle.org

查看:2260
本文介绍了线程“主”中的异常java.net.UnknownHostException:services.gradle.org的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行 gradle.bat 时出现以下错误。我检查了URL路径,看起来很好。 URL在包装器属性中是这样定义的:

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

以下是错误消息:

 下载https://services.gradle.org/distributions/gradle-2.1-bin.zip 
线程mainjava.net中的异常。 UnknownHostException:services.gradle.org at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)

有人可以帮我解决这个问题吗?

解决方案


  1. 转到C:\用户\ [yourusername] \.gradle\文件夹(隐藏文件夹 - 转到文件夹选项,并启用显示隐藏文件,如果文件夹没有显示)

  2. 如果不存在(很可能情况如此),请查找文件gradle.properties,在C:\ Users \ [yourusername] \.gradle\

    li>
  3. 复制并粘贴以下代码(更多详情... https://docs.gradle.org/current /userguide/build_environment.html#sec:gradle_configuration_properties ...为https和user / pwd变量寻找20.3通过代理访问网络)


systemProp.http.proxyHost = [代理服务器]
systemProp.http.proxyPort = [PROXY PORT]



<醇start =4>
  • 保存并重试


  • 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?

    解决方案

    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

    这篇关于线程“主”中的异常java.net.UnknownHostException:services.gradle.org的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆