3.1 下载Flutter SDK
- Stable channel (macOS)下载Flutter SDK
- 将下载后的Flutter SDK移动到某个位置(如:资源库/flutter)
- 添加flutter到path中(.bash_profile)
Flutter=/Users/zxc/Library/flutter
export PATH= F l u t t e r / b i n : Flutter/bin: Flutter/bin:PATH
- 在terminal(终端)中输入 source .bash_profile (使用刚才更新之后的内容)
3.2 运行flutter doctor
- 打开终端,输入下面的指令,检查是否需要安装其他依赖
flutter doctor
3.3 运行错误解决
3.3.1 Some Android licenses not accepted
在终端输入
flutter doctor --android-licenses
3.3.2 CocoaPods not installed
在终端输入
sudo gem install cocoapods
安装异常显示
ERROR: Could not find a valid gem ‘cocoapods’ (>= 0), here is why:
Unable to download data from https://rubygems.org/ - too many connection resets (https://rubygems.org/specs.4.8.gz)
删除旧的连接
gem sources --remove https://rubygems.org/
添加新的连接
gem sources -a https://gems.ruby-china.com
检查设置
gem sources -l
再次执行指令 再次执行flutter doctor
指令
3.3.3 Flutter&Dart plugin not installed
打开android studio开发之工具,依次打开:android studio—>Preferences—>Plugins,输入Flutter
安装
点击:Preferences—>Languages&Frameworks—>Dart&Flutter,配置Dart和Flutter路径
再次执行flutter doctor
检测
3.3.4 VS Code Flutter extension not installed
打开VS Code,搜索flutter
插件安装
安装flutter插件后,再次执行flutter doctor