Flutter demo 启动提示Exception in thread "main" java.net.ConnectException: Connection timed out: connect

xyhxmzg 9月前 612

Flutter assets will be downloaded from https://storage.futter-io.cn. Make sure you trust this source! Launching lib\main.dart on Android SDK built for x86 in debug mode... Running Gradle task 'assembleDebug'... Exception in thread "main" java.net.ConnectException: Connection timed out: connect at java.base/sun.nio.ch.Net.connect0(Native Method) at java.base/sun.nio.ch.Net.connect(Net.java:579) at java.base/sun.nio.ch.Net.connect(Net.java:568) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:633) at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:304) at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:174) at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:183) at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:531) at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:636) at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:266) at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:380) at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:193) at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1242) at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128) at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:179) at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2902) at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2811) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1927) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224) 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

最新回复 (5)
  • HeavyRain 9月前
    引用 2
    这个看着像是环境的问题,不是代码的问题。你从网上找找看,另外是不是需要上外网才可以
  • xyhxmzg 9月前
    引用 3

    Flutter 3.13.2 • channel stable • https://github.com/flutter/flutter.git
    Framework • revision ff5b5b5fa6 (6 months ago) • 2023-08-24 08:12:28 -0500
    Engine • revision b20183e040
    Tools • Dart 3.1.0 • DevTools 2.25.0
  • xyhxmzg 9月前
    引用 4
    flutter demo 版本的 目前支持什么版本
  • xyhxmzg 9月前
    引用 5
    可以了,修改了android/build.gradle 的仓库地址
    //        google()
    //        mavenCentral()
            maven { url 'https://maven.aliyun.com/repository/google' }
            maven { url 'https://maven.aliyun.com/repository/jcenter' }
            maven {
                allowInsecureProtocol true
                url 'http://maven.aliyun.com/nexus/content/groups/public' }
            maven {
                allowInsecureProtocol true
                url "http://download.flutter.io" }
  • xyhxmzg 9月前
    引用 6
    还修改了 :android/gradle/wrapper/gradle-wrapper.properties
    #distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
    distributionUrl=file\:///d:/softs/gradle/gradle-7.4-all.zip
    用本地文件
返回