iis服务器助手广告广告
返回顶部
首页 > 资讯 > 移动开发 >Flutter 安装踩坑记录 HTTP host https://pub.dev/ is not reachable.
  • 651
分享到

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

flutterandroid 2023-09-02 08:09:13 651人浏览 安东尼
摘要

Flutter安装踩坑记录 安装Flutter SDK参考链接 安装Flutter SDK windows安装 flutter官网下载flutter sdk包 解压到C盘除去progr

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.
  • 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://blog.csdn.net/qq_25482087/article/details/124523474

--结束END--

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

本文链接: https://www.lsjlt.com/news/390399.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作