我正在尝试启动一个新的flutter项目,我遵循了入门指南,安装了android studio,flutter sdk,使设备正常工作,并将flutter包添加到了VScode。您可以在此处查看我的扑打医生输出:
D:\Workspace\flutter_app>flutter doctor -v
[√] Flutter (Channel beta, v0.8.2, on Microsoft Windows [Version 6.1.7601],
locale en-US)
• Flutter version 0.8.2 at C:\src\flutter
• Framework revision 5ab9e70727 (4 weeks ago), 2018-09-07 12:33:05 -0700
• Engine revision 58a1894a1c
• Dart version 2.1.0-dev.3.1.flutter-760a9690c2
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at C:\Users\baib37302\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, 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_152-release-1136-
b06)
• All Android licenses accepted.
[√] Android Studio (version 3.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 29.0.2
• Dart plugin version 181.5616
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
[√] VS Code (version 1.27.2)
• VS Code at C:\Users\baib37302\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 2.19.0
[√] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0
(API 27) (emulator)
• No issues found!
我正在使用公司代理,但已将其添加到环境变量中:HTTP_PROXY:http://“ user”:“ pass” @proxy:8080
如您所见,一切看起来都很不错。唯一的问题是我无法运行该项目,因为运行“ Flutter run”会开始执行“ flutter软件包获取”,由于连接到https://pub.dartlang.org时的套接字错误,该工具无法正常工作。如您所见:
D:\Workspace\flutter_app>flutter packages get
Running "flutter packages get" in flutter_app...
Got socket error trying to find package node_preamble at
https://pub.dartlang.org.
pub get failed (69) -- attempting retry 1 in 1 second...
This issue comes up when trying to run from android studio or vs code.
I even tried getting pubscpec.lock file from an example project to try to work around this issue, but that failed as running "flutter install" ends up with gradle error as you can see in:
Flutter crash report; please file at https://github.com/flutter/flutter/issues.
## command
flutter install
## exception
String: Exit code 1 from: D:\Workspace\flutter_app\android\gradlew.bat -v:
Downloading https://services.gradle.org/distributions/gradle-4.4-all.zip
Exception in thread "main" java.net.UnknownHostException: services.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
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:673)
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:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
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:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
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)