我刚刚使用 flutter create
创建了一个应用,但显示以下错误:
Exception in thread "main" java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
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 34.2s
Exception: Gradle task assembleDebug failed with exit code 1
注意:现在,我很久以前创建的所有其他应用都开始出现相同的错误。
Flutter Doctor 好像很正常:
[√] Flutter (Channel stable, 2.0.3, on Microsoft Windows [Version 10.0.19042.867], locale en-IN)
• Flutter version 2.0.3 at H:\flutter
• Framework revision 4d7946a68d (5 weeks ago), 2021-03-18 17:24:33 -0700
• Engine revision 3459eb2436
• Dart version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\VAIO\AppData\Local\Android\sdk
• Platform android-S, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] IntelliJ IDEA Ultimate Edition (version 2020.2)
• IntelliJ at H:\JetBrains\IntelliJ IDEA 2020.2.4
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] Connected device (3 available)
• SM J700F (mobile) • 3300cad6a0626279 • android-arm • Android 6.0.1 (API 23)
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.72
• Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.77
• No issues found!
我只是用谷歌搜索了错误,我认为删除 "C:\Users\VAIO\.gradle\wrapper\dists"
下的文件并用从 gradle.org 下载的文件替换它们。
Flutter run -v,以防万一:
[ +177 ms] executing: [H:\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +139 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +3 ms] 4d7946a68d26794349189cf21b3f68cc6fe61dcb
[ +3 ms] executing: [H:\flutter/] git tag --points-at 4d7946a68d26794349189cf21b3f68cc6fe61dcb
[ +92 ms] Exit code 0 from: git tag --points-at 4d7946a68d26794349189cf21b3f68cc6fe61dcb
[ +2 ms] 2.0.3
[ +94 ms] executing: [H:\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +70 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ +3 ms] origin/stable
[ +1 ms] executing: [H:\flutter/] git ls-remote --get-url origin
[ +63 ms] Exit code 0 from: git ls-remote --get-url origin
[ +2 ms] https://github.com/flutter/flutter.git
[ +128 ms] executing: [H:\flutter/] git rev-parse --abbrev-ref HEAD
[ +69 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +2 ms] stable
[ +122 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +7 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +4 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +119 ms] executing: C:\Users\VAIO\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[ +85 ms] List of devices attached
3300cad6a0626279 device product:j7eltexx model:SM_J700F device:j7elte transport_id:1
[ +14 ms] C:\Users\VAIO\AppData\Local\Android\sdk\platform-tools\adb.exe -s 3300cad6a0626279 shell getprop
[ +330 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +7 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +147 ms] Skipping pub get: version match.
[ +232 ms] Generating H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat
app\nifty\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[ +112 ms] ro.hardware = samsungexynos7580
[ +82 ms] Initializing file store
[ +18 ms] Skipping target: gen_localizations
[ +10 ms] complete
[ +10 ms] Launching lib\main.dart on SM J700F in debug mode...
[ +9 ms] H:\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev
H:\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
H:\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names
--experimental-emit-debug-metadata --output-dill
C:\Users\VAIO\AppData\Local\Temp\flutter_tools.37686b47\flutter_tool.2002fc6\app.dill --packages
H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\.dart_tool\package_config.json -Ddart.vm.profile=false
-Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root
--initialize-from-dill build\cache.dill.track.dill
[ +30 ms] executing: C:\Users\VAIO\AppData\Local\Android\sdk\platform-tools\adb.exe -s 3300cad6a0626279 shell -x logcat
-v time -t 1
[ +27 ms] <- compile package:nifty/main.dart
[ +297 ms] --------- beginning of system
04-19 19:36:39.431 E/Watchdog( 2613): !@Sync 4999 [04-19 19:36:39.445]
[ +24 ms] executing: C:\Users\VAIO\AppData\Local\Android\sdk\platform-tools\adb.exe version
[ +95 ms] Android Debug Bridge version 1.0.41
Version 31.0.1-7187441
Installed as C:\Users\VAIO\AppData\Local\Android\sdk\platform-tools\adb.exe
[ +8 ms] executing: C:\Users\VAIO\AppData\Local\Android\sdk\platform-tools\adb.exe start-server
[ +86 ms] Building APK
[ +63 ms] Running Gradle task 'assembleDebug'...
[ +76 ms] Using gradle from H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\android\gradlew.bat.
[ +39 ms] H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\android\gradlew.bat mode: 33279 rwxrwxrwx.
[ +53 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +227 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +5 ms] openjdk version "1.8.0_242-release"
OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
OpenJDK 64-Bit Server VM (build 25.242-b01, mixed mode)
[ +5 ms] executing: [H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\android/]
H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\android\gradlew.bat -Pverbose=true
-Ptarget-platform=android-arm -Ptarget=H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\lib\main.dart
-Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root assembleDebug
[ +457 ms] Downloading https://services.gradle.org/distributions/gradle-6.7-all.zip
[+21569 ms] Exception in thread "main" javax.net.ssl.SSLHandshakeException: Remote host closed connection during
handshake
[ +7 ms] at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:994)
[ ] at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
[ +1 ms] at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
[ +2 ms] at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
[ +1 ms] at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
[ +2 ms] at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
[ +2 ms] at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
[ +1 ms] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
[ +1 ms] at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
[ +1 ms] at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
[ +1 ms] at org.gradle.wrapper.Download.download(Download.java:44)
[ +1 ms] at org.gradle.wrapper.Install$1.call(Install.java:61)
[ +8 ms] at org.gradle.wrapper.Install$1.call(Install.java:48)
[ +2 ms] at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
[ +2 ms] at org.gradle.wrapper.Install.createDist(Install.java:48)
[ +1 ms] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
[ +1 ms] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
[ +7 ms] Caused by: java.io.EOFException: SSL peer shut down incorrectly
[ +2 ms] at sun.security.ssl.InputRecord.read(InputRecord.java:505)
[ +1 ms] at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:975)
[ +1 ms] ... 16 more
[ +62 ms] Running Gradle task 'assembleDebug'... (completed in 22.5s)
[ +10 ms] [!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
[ +9 ms] Running Gradle task 'assembleDebug'...
[ +8 ms] Using gradle from H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\android\gradlew.bat.
[ +1 ms] H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\android\gradlew.bat mode: 33279 rwxrwxrwx.
[ +1 ms] executing: [H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\android/]
H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\android\gradlew.bat -Pverbose=true
-Ptarget-platform=android-arm -Ptarget=H:\Abhinav\Flutter_Projects\Nifty - The Ultimate Chat app\nifty\lib\main.dart
-Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root assembleDebug
[ +333 ms] Downloading https://services.gradle.org/distributions/gradle-6.7-all.zip