最近安装了Flutter并探索了hello-world app。遵循https://flutter.io/get-started/提到的所有步骤并且能够运行
::扑医生
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.
还能够使用以下命令创建app骨架;
:: flutter创建myapp
但是当它试图安装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 env变量来获得连接。
在Windows上打开cmd
设置https_proxy = USERNAME:PASSWORD @ hostname:port
扑动创造
扑了一下
扑动包得到
这对我有用,希望它有所帮助!
设置以下Windows环境变量后,我成功了。
变量名称:DART_VM_OPTIONS变量值: - root-certs-file = path_to_cert
其中path_to_cert是完全限定的路径。
您可能需要设置自签名证书,以通过设置以下环境变量使其正常工作:
在Linux上:
export DART_VM_OPTIONS =“ - root-certs-file = {path.to.certificate.file}”
在Windows上:
set https_proxy =“ - root-certs-file = {path.to.certificate.file}”