首页 文章

公司防火墙后面的颤动应用程序在程序包获取期间抛出TLS错误

提问于
浏览
2

最近安装了Flutter并探索了hello-world app . 遵循https://flutter.io/get-started/中提到的所有步骤并且能够运行

:: flutter doctor

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 create 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实现这样的代理的方法 . 我也试过使用中国服务器,但这也没有帮助我 . 我已经安装和卸载了几次,以确保缓存不会导致此问题 .

有没有人想出来了吗?

2 回答

  • 1

    我遇到过同样的问题 . 我在一家公司工作,我不得不使用https_proxy env变量来获得连接 .

    在Windows上打开cmd

    设置https_proxy = USERNAME:PASSWORD @ hostname:port flutter create flutter run flutter packages get

    这对我有用,希望它有所帮助!

  • 0

    您可能需要设置自签名证书,以通过设置以下环境变量使其正常工作:

    在Linux上:

    export DART_VM_OPTIONS =“ - root-certs-file =

    在Windows上:

    set https_proxy =“ - root-certs-file =

相关问题