记Flutter执行flutter doctor --android-licenses时出现错误
错误描述
今天刚刚安装好Flutter,执行了
$ flutter doctor
结果如图所示,出现一个Android令牌状态不可知的错误。根据提示信息,执行如下的命令,
$ flutter doctor --android-licenses
结果是,出现了一个代理错误。
Error: The proxy server URL extracted from HTTP_PROXY or HTTPS_PROXY environment variable could not be parsed. Either specify the correct URL or unset the environment variable.
java.net.MalformedURLException: no protocol: 127.0.0.1:7890
at java.net.URL.<init>(URL.java:593)
at java.net.URL.<init>(URL.java:490)
at java.net.URL.<init>(URL.java:439)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:483)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:154)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:136)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
因为显示的7890正是我的代理端口,所以我尝试把代理关闭,但结果依然是这样。
解决方法
Windows
在cmd中执行如下的命令
$ set HTTP_PROXY=http://127.0.0.1:9870
$ set HTTPS_PROXY=http://127.0.0.1:9870
之后,再次尝试即可
Mac
在bash.profile后面添加:
export HTTP_PROXY=http://127.0.0.1:9870
export HTTPS_PROXY=http://127.0.0.1:9870
之后,再次尝试即可