问题:
最新学习flutter,安装环境时执行flutter doctor ,遇到很多问题,以下列举
1.cmdline-tools component is missing
打开Android studio -》setting-》Android SDK,下载缺失的cmdline-tools 组件,如下图
2.HTTP Host Availability , HTTP host https://maven.google.com/ is not reachable
找到安装路径下面的文件flutter\packages\flutter_tools\lib\src\
找到'https://maven.google.com/',改成 'https://dl.google.com/dl/android/maven2/'
3.缺失C++桌面开发组件,提示:Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the “Desktop development with C++” workload, and include these components
搜索打开
Visual Studio Installer
点击修改
在以下页面勾选”使用c++的桌面开发“ ,并确保右边箭头指出的3个组件也勾选了
4.执行时卡在running pub upgrade这里
解决:
点击电脑右键属性-》高级系统设置-》环境变量,或者在系统运行栏输入”env“进入环境变量设置页面,新增两个用户变量
FLUTTER_STORAGE_BASE_URL https://storage.flutter-io.cn
PUB_HOSTED_URL Dart packages
然后重新执行 flutter doctor
5.Android licenses not accepted
协议未接受,按照提示执行 flutter doctor --android-licenses,提示输入Y/N的地方依次输入Y
到这一步就完成拉,还有没列举到的我这边没有遇到,无法复现问题,大家请见谅。不过一般按照提示去操作就可以拉。