Flutter问题记录:runApp的时候报错:连接超时

  • Post author:
  • Post category:其他


问题:Launching lib\main.dart on ELE AL00 in debug mode…

Running Gradle task ‘assembleDebug’…

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.www.http.HttpClient.openServer(HttpClient.java:463)

at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)

at sun.net.www.protocol.https.HttpsClient.<init>(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:1156)

at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)

at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)

at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)

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)

Exception: Gradle task assembleDebug failed with exit code 1

解决方案:

1、调整项目空间中的gradle-wrapper.properties文件中的URL,改为你本地最新的gradle版本就好

如:

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

2、调整Android包中的build.gradle文件中的kotlin版本号:跟本地kotlin版本同步就行

如:ext.kotlin_version = ‘1.3.50’



版权声明:本文为songniansun7229原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。