Flutter 安装踩坑记录 HTTP host https://pub.dev/ is not reachable.

这篇具有很好参考价值的文章主要介绍了Flutter 安装踩坑记录 HTTP host https://pub.dev/ is not reachable.。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

安装Flutter SDK

  1. Windows安装
    flutter官网下载flutter sdk包

2.解压到C盘除去program file相关的目录(最好自己创建一个新的目录,因为放在program file等目录需要特殊的权限,会出现问题)

  1. Android 需要安装Android SDK ,同理苹果开发也需要对应的环境

  2. 安装ide工具(Android Studio ,visual studio code)都可以

  3. 运行 flutter doctor检查安装环境

PS C:\Android\flutter\bin> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Version 10.0.19042.1645], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.0-preview)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Enterprise 2022 17.1.0)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop
      development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[√] Android Studio (version 2021.1)
[√] VS Code, 64-bit edition (version 1.66.1)
[√] Connected device (3 available)
[!] HTTP Host Availability
    X HTTP host https://maven.google.com/ is not reachable. Reason: An error occurred while checking the HTTP host:
      Failed host lookup: 'maven.google.com'
    X HTTP host https://pub.dev/ is not reachable. Reason: An error occurred while checking the HTTP host: Failed host
      lookup: 'pub.dev'
    X HTTP host https://cloud.google.com/ is not reachable. Reason: An error occurred while checking the HTTP host:
      Failed host lookup: 'cloud.google.com'

! Doctor found issues in 3 categories.

Flutter 安装踩坑记录 HTTP host https://pub.dev/ is not reachable.
提示错误
-Waiting for another flutter command to release the startup lock...
- 看到任务管理器里面有9个dart服务在运行,因此删除不了 flutter 安装目录下的bin/cache/lockfile文件,可以使用下面的命令停止dart服务的运行

// Linux
killall -9 dart

// Windows
taskkill /F /IM dart.exe

C:\WINDOWS\system32>taskkill /F /IM dart.exe
SUCCESS: The process "dart.exe" with PID 58904 has been terminated.
SUCCESS: The process "dart.exe" with PID 59660 has been terminated.
SUCCESS: The process "dart.exe" with PID 64856 has been terminated.
SUCCESS: The process "dart.exe" with PID 64820 has been terminated.
SUCCESS: The process "dart.exe" with PID 69264 has been terminated.
SUCCESS: The process "dart.exe" with PID 65924 has been terminated.
SUCCESS: The process "dart.exe" with PID 61544 has been terminated.
SUCCESS: The process "dart.exe" with PID 68612 has been terminated.
SUCCESS: The process "dart.exe" with PID 66868 has been terminated.
SUCCESS: The process "dart.exe" with PID 55608 has been terminated.
SUCCESS: The process "dart.exe" with PID 67136 has been terminated.
SUCCESS: The process "dart.exe" with PID 73776 has been terminated.
  • HTTP host https://maven.google.com/ is not reachable. Reason: An error occurred while checking the HTTP host: Failed host lookup: 'maven.google.com'
    - 替换flutter\packages\flutter_tools\lib\src\http_host_validator.dart 目录下的 'maven.google.com''https://dl.google.com/dl/android/maven2/'
    - 关闭所有命令行窗口,再打开命令行窗口
    - 去到flutter\bin目录,删除cache文件夹
    - 重新运行flutter doctor
Could not resolve URL "https://pub.flutter-io.cn".
pub get failed (server unavailable) -- attempting retry

powershell中运行

setx PUB_HOSTED_URL "https://pub.flutter-io.cn"
setx FLUTTER_STORAGE_BASE_URL "https://storage.flutter-io.cn"

参考链接

如何解决“Waiting for another flutter command to …”
[转]Windows构建Flutter环境,无法访问maven.google.com
Step by step setting up flutter and pub mirrors in china using Windows Operating System #46641
【flutter】pub get failed (server unavailable) – attempting解决办法
vscode 安装flutter遇到的坑文章来源地址https://www.toymoban.com/news/detail-479730.html

到了这里,关于Flutter 安装踩坑记录 HTTP host https://pub.dev/ is not reachable.的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • apache配置安全证书https踩坑记录

    apache配置安全证书有如下几步 一、申请证书 这个网上有很多免费的,我用的是阿里云的服务器,在阿里云后台就可以申请免费证书。 二、上传证书 申请好证书后,根据服务器用的什么软件,是apache还是ngnix,下载相应的证书文件,我用的是apache,有三个文件:公钥文件、私

    2024年02月12日
    浏览(30)
  • InsecureRequestWarning警告:InsecureRequestWarning: Unverified HTTPS request is being made to host

    1、错误信息 InsecureRequestWarning: Unverified HTTPS request is being made to host \\\'10.1.1.145\\\'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings     InsecureRequestWarning, -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 查了文档如何捕获警

    2024年04月11日
    浏览(24)
  • 【Unity 踩坑系列】VScode的csproj文件路径失效more errors occurred. (This project is not supported in C# Dev Kit.)

    在使用VScode配置Unity的开发环境时候遇到了以下的问题: 在VScode打开Unity项目中的脚本时在Project OutPut里会报出一大堆csproj文件路径失效的报错 [warning] The project file ‘d:UnityProjectUnity.Services.Core.Configuration.csproj’ is in unsupported format (for example, a traditional .NET Framework project). It

    2024年02月07日
    浏览(34)
  • 解决:InsecureRequestWarning:Unverified HTTPS request is being made to host ‘xx.cn’. Adding ......

    在使用之前的代码时,报错:D:/Anaconda_soft/envs/pytorch/lib/site-packages/urllib3/connectionpool.py:1043: InsecureRequestWarning: Unverified HTTPS request is being made to host ‘www.dytt89.com’. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings 主要报错信息

    2024年02月01日
    浏览(29)
  • 【python】python运行脚本出现InsecureRequestWarning:Unverified HTTPS request is being made to host错误

    大概意思就是没有正在向主机发出未经验证的 HTTPS 请求 ,所以需要关闭校验 添加 requests.packages.urllib3.disable_warnings() verify=False 个人网站:沉默博客 如有错误,请多多指教。 如对你有帮助,给个赞吧。

    2024年02月11日
    浏览(55)
  • flutter flutter pub cache clean和flutter clean区别

    flutter pub cache clean 和 flutter clean 是 Flutter 开发中两个不同的命令,它们的作用和使用场景有所不同。 flutter pub cache clean :这个命令用于清理 Flutter 的包缓存。在使用 Flutter 进行开发时,会下载和缓存一些第三方依赖包,这些包会被保存在 Flutter 的包缓存中。 flutter pub cache c

    2024年02月03日
    浏览(34)
  • HTTP请求头大小写问题踩坑记录

    类似网关的需求做请求转发,大概是接收到客户端http请求后做简单处理,之后通过httpclient转发出去,其中请求头需要全部透传过去。但是直接全部无脑传过去会出现问题,比如因为处理过请求,所以长度已经变了,客户端的请求头content-length已经不再适用了,再比如如果客户

    2024年02月11日
    浏览(28)
  • 《Docker》阿里云服务器docker部署nginx并配置https踩坑记录(完整)

    前端博主,热衷各种前端向的骚操作,经常想到哪就写到哪,如果有感兴趣的技术和前端效果可以留言~博主看到后会去代替大家踩坑的~ 主页: oliver尹的主页 格言: 跌倒了爬起来就好~ 来个关注吧,点个赞吧,谢谢 今天在为阿里云服务器续期的时候发现原来阿里云上面也

    2024年02月06日
    浏览(35)
  • 关于网络问题:WARNING: ROS_MASTER_URI [http://EPRobot:11311] host is not set to this machine

    如果需要远程链接,需要在远程服务器将ROS_MASTER_URI变为启动roscore的地址,即master地址 那么为什么有了IP地址还需要主机名呢? ip地址等于身份证号,主机名等于姓名,身份证号是独一无二的 1.找IP地址 2.解决 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直

    2024年02月16日
    浏览(35)
  • Elasticsearch踩坑:received plaintext http traffic on an https channel, closing connection Netty4HttpCh

    当我们访问ip+9200 验证是否启动成功时报错 received plaintext http traffic on an https channel, closing connection Netty4HttpChannel{localAddress=/172.16.5.10:9200, remoteAddress=/172.16.11.68:11111} 如图: 原因:Elasticsearch开启了安全认证 解决:在config/目录下面的elasticsearch.yml配置文件,把安全认证开关从原先

    2024年02月04日
    浏览(34)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包