flutter医生--android许可证代理服务器错误



我最近下载了android sdk,当我运行flutter doctor时,它抱怨说android许可证状态未知。我已经运行了颤振医生-安卓许可证,正如它所说的,我有这个错误

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:56885
at java.base/java.net.URL.<init>(URL.java:645)
at java.base/java.net.URL.<init>(URL.java:541)
at java.base/java.net.URL.<init>(URL.java:488)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:470)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:58)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:49)

注意:我已经安装了Android SDK命令行工具

有什么建议如何解决这个问题吗?

在flutter命令行中运行Get-ChildItem Env:
这将列出所有本地环境变量

请确保"HTTP_PROXY"one_answers"HTTPS_PROXY"变量在该列表中
然后运行Remove-Item -Path Env:http_proxyRemove-Item -Path Env:https_proxy以删除它们

我遇到了类似的问题,刚刚找到了解决方案。

如果遇到此特定错误,可能是您在电脑上使用了代理,并且没有正确设置代理配置。

错误java.net.MalformedURLException: no protocol: 127.0.0.1:56885表示您没有在URL中包含协议HTTPHTTPS

解决方案是指定正确的URL,或者根据错误提示取消设置环境变量。

要解决此问题,请重新运行用于设置代理的命令,不要忘记在URL中包含http://https://

在Windows命令提示符下:

set http_proxy=http://hostname:port
set https_proxy=https://hostname:port

在Linux/macOS:

export http_proxy=http://hostname:port
export https_proxy=https://hostname:port

NB

  1. 在geo_n的情况下,命令是set http_proxy=http://127.0.0.1:56885而不是set http_proxy=127.0.0.1:56885
  2. 如果您没有使用代理服务器或不想使用代理服务器,可以使用命令set http_proxy=set https_proxy=删除代理配置,或者尝试使用Shaleny Legnb的答案取消设置环境变量

最新更新