下载Flutter SDK
使用Git安装
如果已经下载过flutter的,切换到flutter目录去直接
git checkout beta
git pull
//可能会失败,因为这个目录中可能有修改过,要目放弃修改,要么暂存均可
(如果失败,这里选择了暂存) -- Start
git checkout beta
git stash
git pull
(如果失败,这里选择了暂存) -- End
未下载过,第一次安装
//克隆flutter的beta分支
git clone -b beta https://github.com/flutter/flutter.git
配置"环境变量"
熟悉命令的自己搞一下
//把 安装目录/flutter/bin
export PATH=`pwd`/flutter/bin:$PATH
不熟悉的
~ ⌚ 0:01:37
$ vim ~/.bash_profile
//会进入vim编辑,如下配置即可
export FLUTTER_HOME=/Users/phyooos/develop/flutter
export PATH=$PATH:$FLUTTER_HOME/bin:
不会的
open ~/.bash_profile
//编辑器,总可以了吧,如下配置即可
export FLUTTER_HOME=/Users/phyooos/develop/flutter
export PATH=$PATH:$FLUTTER_HOME/bin:
放一下我自己的配置:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0/Contents/Home
export ANDROID_HOME=/Users/phyooos/Library/Android/sdk
export TOMCAT_HOME=/Users/phyooos/develop/apache-tomcat-7.0.77
export GRADLE_USER_HOME=/Users/phyooos/develop/gradle
export MYSQL_HOME=/usr/local/mysql-5.7.18-macos10.12-x86_64
export GOROOT=/usr/local/go
export GOPATH=/Users/phyooos/develop/workspace
export GOBIN=$GOPATH/bin
export SCALA_HOME=/Users/phyooos/develop/scala-2.11.8
export MAVEN_HOME=/Users/phyooos/develop/apache-maven-3.5.0
export FLUTTER_HOME=/Users/phyooos/develop/flutter
export PATH=/usr/local/Cellar/git/2.15.0/bin:$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$TOMCAT_HOME/bin:$GRADLE_HOME/bin:$MYSQL_HOME/bin:$GOROOT/bin:$GOPATH:$GOBIN:$GOPATH/bin:$FLUTTER_HOME/bin:$MAVEN_HOME/bin:$SCALA_HOME/bin
安装Flutter
flutter doctor
这里要注意的是,这个配置需要"良好的网络环境",最好翻墙下载为妙,但是终端不走代理
所以,需要手动给终端配置一下,请看我另一篇文章