一、
在用户根目录~/ 下创建一个development文件夹

二、
cd 到文件夹
git clone github上flutter地址
注意:
官网是下载zip然后解压到文件夹,这种情况下 flutter doctor会报错,所以直接git clone 就不会出现这个问题
Error: The Flutter directory is not a clone of the GitHub project.
The flutter tool requires Git in order to operate properly;
to set up Flutter, run the following command:
git clone -b beta https://github.com/flutter/flutter.git
三、配置环境变量
vim .bash_profile 打开个人用户下环境变量 然后按i 进入插入模式
编辑完环境变量 之后 esc退出编辑模式 然后按shift + :
wq!保存
source .bash_profile 可立即生效

export PATH=/Users/gongshouhui/development/flutter/bin:$PATH
/Users/gongshouhui/development/flutter/bin 这个是个人flutterbin路径
四、

对于这个要打开终端输入open ~/.zshrc
然后添加source .bash_profile 就可以每次都生效了

五、运行
flutter doctor
六、运行flutter doctor出现Android license status unknown的解决方法
将Java sdk 换成 Java 1.8 版本就好了;
网友评论