mac上如何配置flutter之安卓

lude1994發表於2020-07-20

1.環境配置:

 

1.開啟終端,輸入 open ./.bash_profile

export ANDROID_HOME=/Users/wenjianming/Library/Android/sdk


export PATH="~/flutter/bin/:$PATH"
export PATH="~/flutter/bin/cache/dart-sdk/bin:$PATH"

export PATH="$ANDROID_HOME/tools:$PATH"
export PATH="$ANDROID_HOME/platform-tools:$PATH"

// java 環境配置
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home"
PATH="$JAVA_HOME/bin:$PATH"
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH

 

2.儲存後用source .bash_profile使變數配置生效

 

 

3.下載sdk包,將檔案解壓

git clone -b beta https://github.com/flutter/flutter.git

 

4.開啟android studio 安裝 flutter、dart外掛

 

5.安裝完後在終端輸入flutter doctor,若報錯Android license status unknown ,請看我上一篇文章

 

6.安裝完成後,建立flutter專案

flutter create appname

7.建立完成後進入專案,需要提前開啟模擬器

flutter run

 8.以下是安卓上的執行效果,由於配置xcode比安卓簡單,就不記錄了

 

相關文章