美文网首页
flutter环境配置

flutter环境配置

作者: 白河三 | 来源:发表于2021-04-12 21:18 被阅读0次

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


image.png

二、
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  可立即生效


image.png
export PATH=/Users/gongshouhui/development/flutter/bin:$PATH

/Users/gongshouhui/development/flutter/bin 这个是个人flutterbin路径

四、

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

五、运行
flutter doctor

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

相关文章

网友评论

      本文标题:flutter环境配置

      本文链接:https://www.haomeiwen.com/subject/jszeuktx.html