編寫Flutter app前的準備——在Android studio上安裝模擬器
Published in
2 min readJan 24, 2020
Android模擬器
- 打開Android studio
- 點選工具列上的Tools > AVD Manager
- 點選左下角的Create Virtual Device
- 選擇你想要的模擬器,推薦Nexus 6,點選Next
- 選擇你想要的Android 版本,推薦Android Pie,當然你也可以全部安裝,但我認為至少要兼容到Pie
- 接下來就能先跑跑看Flutter的範例程式了
如果出現了下面的錯誤訊息:To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.代表有某些License還沒有同意,打開terminal,輸入以下指令:
flutter doctor --android-licenses照著畫面上的流程走就會把需要的License都準備好了。
iOS模擬器
- 安裝Xcode
- 設定Xcode command-line tools
輸入
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
$ sudo xcodebuild -runFirstLaunch
順便提醒一下,基本上需要做的動作都可以藉由flutter doctor來查詢,例如:
之後就能在Android studio中切換iOS及Android模擬器了