前言:
现在你们对“connet timed out”大体比较关切,小伙伴们都需要学习一些“connet timed out”的相关资讯。那么小编同时在网络上汇集了一些有关“connet timed out””的相关知识,希望咱们能喜欢,大家一起来了解一下吧!问题:Flutter create新建项目之后运行,一直报错显示Exception in thread "main" java.net.ConnectException: Connection timed out: connect
Exception in thread "main" java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net. at sun.net. at sun.net.;init>(HttpsClient.java:264) at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at org.gradle.wrapper.Download.downloadInternal(Download.java:58) at org.gradle.wrapper.Download.download(Download.java:44) at org.gradle.wrapper.Install$1.call(Install.java:61) at org.gradle.wrapper.Install$1.call(Install.java:48) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65) at org.gradle.wrapper.Install.createDist(Install.java:48) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)Running Gradle task 'assembleDebug'...Running Gradle task 'assembleDebug'... Done 26.4sException: Gradle task assembleDebug failed with exit code 1
其实主要估计就是网络超时问题,我上网搜了一波发现都建议
需要修改项目下 android/build.gradle 和 flutter 安装目录flutter/packages/flutter_tools/gradle/flutter.gradle 两个文件中 buildscript 和allprojects 中的
google()jcenter()
替换成阿里云镜像
maven { url '; }maven { url '; }maven { url'; }
但是我替换后还是回显示同样的错误,开始思考其实之所以这样修改,是因为更快下载到需要的gradle.zip文件,所以我就直接在这里下载我所需要的grade文件直接引用本地的来运行,结果成功运行了
步骤一:到你项目里面的gradle-wrapper.properties文件里面查找到你所需要的版本,我这里是gradle-6.7-all.zip
步骤二:到这里找到对应的版本下载
步骤三:找到你的.grade地方,我电脑所在是 C:\Users\husk\.gradle ,然后将刚刚下载成功的zip包放在该目录下(其实你喜欢放在哪都无所谓,反正到时候引入本地这个zip就好)
步骤四:到你项目里面的gradle-wrapper.properties文件里面将原来的 distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 换乘本地的
然后运行,运行成功了!!!
标签: #connet timed out