电脑:Mac
软件:Android Studio,下载地址
1.cd指指定的目录,下载sdk
git clone -b beta https://github.com/flutter/flutter.git
2.环境配置
#配置环境
export PATH= xxxx/flutter/bin:$PATH
#如果下载太慢或者失败,那么需要先配置中国镜像,然后再clone项目
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
记得完了,执行 source ~/.bash_profile
3.配置flutter,下载 Dart SDK 执行命令:
flutter
4.执行:
flutter doctor
⚠️这里提示 Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses,根据提示,执行:
flutter doctor --android-licenses
一直按y到底
5.打开android studio, 打开plugin,搜索flutter,点击install,完毕restart。
6.新建一个flutter项目,打开。
踩坑记录:
1.在新建过程中,遇到sdk报错的问题,最后执行 flutter upgrade 解决。
2.AndroidStudio 运行flutter项目无法选择iOS模拟器:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch