***安装问题***
如官网所说,访问flutter可能会受限,所以我们可以在~/.bash_profile或者~/.zshrc中设置临时镜像
```
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
```
记住,设置之后运行source ~/.bash_profile或者~/.zshrc
之后我们可以下载相应的sdk,官网下载地址:https://flutter.dev/docs/development/tools/sdk/releases?tab=macos#macos或者去github下载:https://github.com/flutter/flutter/releases
安装完成后,我们需要将flutter工具路径配置到我们的配置文件中,需要将
```
export PATH=`pwd`/flutter/bin:$PATH
```
添加到~/.bash_profile或者~/.zshrc ,同样执行source命令
接下来,我们需要执行flutter doctor检查依赖项是否都已安装。你可能会遇到下面的问题
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this problem.
使用Android Studio的小伙伴,进入Preferences -> Android SDK -> SDK Tools -> Android SDK Command-line Tools 勾选,并点击应用,等待下载即可。
如有其他问题,比照flutter doctor给出的问题提示修改即可。
网友评论