文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

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

2023-09-02 08:35

关注

Flutter安装踩坑记录

安装Flutter SDK

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

解压到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 doctorDoctor 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 doctor
提示错误
-Waiting for another flutter command to release the startup lock...
- 看到任务管理器里面有9个dart服务在运行,因此删除不了 flutter 安装目录下的bin/cache/lockfile文件,可以使用下面的命令停止dart服务的运行

// Linuxkillall -9 dart// Windowstaskkill /F /IM dart.exe
C:\WINDOWS\system32>taskkill /F /IM dart.exeSUCCESS: 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.
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://blog.csdn.net/qq_25482087/article/details/124523474

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-移动开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯