Flutter Mac iOS 环境配置

官方文档:https://flutter.io/docs/get-started/install/macos

1.需要的命令行工具

bash
curl
git 2.x
mkdir
rm
unzip
which

2.SDK下载地址

flutter_macos_v1.0.0-stable.zip
https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_v1.0.0-stable.zip

3.解压Flutter SDK

cd ~/Flutter/SDK
$ unzip ~/Downloads/flutter_macos_v1.0.0-stable.zip
Flutter SDK 包含了Dart SDK,不需要单独安装Dart SDK

4.设置Flutter SDK环境变量

4.1 打开或者创建$HOME/.bash_profile
vi $HOME/.bash_profile

4.2 在最后加入下面的命令
export PATH=$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin

例如:
export PATH=$PATH:/Users/junhuashao/Flutter/SDK/flutter/bin

4.3 完成后更新下环境变量
source $HOME/.bash_profile

4.4 添加完成后,调用命令 “echo $PATH”,查看环境变量是否添加成功

5.运行Flutter

5.1 运行命令“flutter doctor -v”检测SDK安装是否成功。如果存在错误,根据提示来修复错误

比如我的提示就是
✗ Verify that all connected devices have been paired with this computer in Xcode.
If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
To update with Brew, run:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install with Brew:
brew install ios-deploy

出现这个提示,把手机连接上,或者模拟器开起来,再试一次。
Tips:快速打开模拟器的方法,在命令行执行命令“open -a Simulator”,在 Hardware > Device 中可以切换设备

为 Android Studio安装Flutter和Dart插件

1.开启Android Studio。
2.打开设置(Preferences > Plugins)
3.点击Browse repositories,搜索Flutter plugin,点击Install
4.当提示要安装Dart插件的时候,点击YES。
5.安装完成后点击Restart Android Studio,重启下。

你可能感兴趣的:(Flutter)