最近安装了 Flutter 并探索了 hello-world 应用程序。遵循 https://flutter.io/get-started/ 中提到的所有步骤并且能够运行
:: flutter 医生
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [Version 10.0.15063], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.2)
[√] Android Studio (version 3.1)
[!] VS Code, 64-bit edition (version 1.26.0)
[√] Connected devices (1 available)
! Doctor found issues in 1 categories.
还可以使用以下命令创建应用程序骨架;
:: flutter 创建我的应用程序
但是当它尝试安装 pubspec.yaml 下提到的所有依赖项时,它开始显示错误并不断尝试重新连接。这是日志,
Running "flutter packages get" in hello_world...
Got TLS error trying to find package cupertino_icons at https://pub.dartlang.org.
pub get failed (69) -- attempting retry 1 in 1 second...
Got TLS error trying to find package cupertino_icons at https://pub.dartlang.org.
pub get failed (69) -- attempting retry 2 in 2 seconds...
我怀疑这是因为防火墙和其他包管理器,我一直在使用代理服务器来启用 fetch,它工作得很好。我找不到为 flutter 或 pub 实现这种代理的方法。我也尝试使用中国服务器,但这也没有帮助我。我已经安装和卸载了几次,以确保缓存不会导致此问题。
有人知道这个吗?
最佳答案
我有同样的问题。我在一家公司工作,我不得不使用 https_proxy 环境变量来获得连接。
在 Windows 上打开 cmd
set https_proxy=USERNAME:PASSWORD@hostname:port
flutter create
flutter run
flutter packages get
这对我有用,希望对你有帮助!
关于proxy - 企业防火墙后面的 Flutter 应用程序在获取包期间引发 TLS 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51883151/