flutter安装各种问题汇总

C:\Users\Administrator>flutter doctor -v
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
[√] Flutter (Channel stable, 3.7.0, on Microsoft Windows [版本 10.0.19044.1826], locale zh-CN)
    • Flutter version 3.7.0 on channel stable at D:\soft_install\flutter_windows_3.7.0-stable\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b06b8b2710 (9 weeks ago), 2023-01-23 16:55:55 -0800
    • Engine revision b24591ed32
    • Dart version 2.19.0
    • DevTools version 2.20.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[X] Windows Version (Unable to confirm if installed Windows version is 10 or greater)

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at D:\soft_install\Android\Sdk
    • Platform android-33, build-tools 33.0.2
    • ANDROID_HOME = D:\soft_install\Android\Sdk
解决 设置环境变量SDK安装文件夹
    • Java binary at: D:\soft_install\Android\Android Studio4-1\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
运行失败的话,gui界面的sdk 下载cmdline-tools,降低版本到8.0
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web
    • CHROME_EXECUTABLE = C:\Users\Administrator\AppData\Local\Google Chrome\Chromebin\chrome.exe

[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 4.1)
    • Android Studio at D:\soft_install\Android\Android Studio4-1
解决方法,先到gui界面的sdk 下载cmdline-tools工具,会自动下载到D:\soft_install\Android\Sdk\cmdline-tools
(1)配置Android studio的命令:flutter config --android-studio-dir=“D:\software\Android Studio\studio”
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (2 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [版本 10.0.19044.1826]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 89.0.4389.90

[√] HTTP Host Availability
    • All required HTTP hosts are available
问题http
解决:
删除缓存 :Flutter SDK路径/flutter/bin/cache
进入
Flutter SDK路径/flutter/packages/flutter_tools/lib/src/http_host_validator.dart


/// Android specific required HTTP hosts.
List<String> androidRequiredHttpHosts(Platform platform) {
  return <String>[
    // If kEnvCloudUrl is set, it will be used as the maven host
    if (!platform.environment.containsKey(kEnvCloudUrl))
      'https://maven.google.com',
  ];
}
改成:


/// Android specific required HTTP hosts.
List<String> androidRequiredHttpHosts(Platform platform) {
  return <String>[
    // If kEnvCloudUrl is set, it will be used as the maven host
    if (!platform.environment.containsKey(kEnvCloudUrl))
      'https://dl.google.com/dl/',
  ];
}
再将 kPubDevHttpHost 和 kgCloudHttpHost 两个常量 分别修改为 https://pub.flutter-io.cn/ 和 https://storage.flutter-io.cn/(解决第二个)

const String kPubDevHttpHost = 'https://pub.flutter-io.cn/';
const String kgCloudHttpHost = 'https://storage.flutter-io.cn/';

 
链接:https://www.jianshu.com/p/d1a923b9d298
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值