1、梯子
2、安装brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
3、下载flutter(记住flutter/bin的路径,配置环境变量)
https://flutter.io/setup-macos/
4、配置环境变量
vim ~/.bash_profile 输入:export PATH=“/flutter bin路径”:$PATH :wq(退出) enter
5、环境变量生效
source ~/.bash_profile
6、检测是否安装完成
flutter -h
7、检测开发环境
flutter doctor
8、安装studio
安装之前要安装java http://www.android-studio.org/
9、终端输入命令
brew install --HEAD libimobiledevice brew install ideviceinstaller brew install ios-deploy brew install cocoapods pod setup
10、启动andriod studio
plugins中搜索flutter
下载flutter
11、创建flutter项目
打开andriod studio start a new flutter project(好慢) 选择flutter application 安装avd虚拟机 tool - avd manager create virtual device nexus 5x andriod 9 next
12、debug
报错 修改掉项目下的android目录下的build.gradle文件 maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url ‘http://maven.aliyun.com/nexus/content/groups/public'} \Flutter\flutter\packages\flutter_tools\gradle maven { url 'https://m aven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url ‘http://maven.aliyun.com/nexus/content/groups/public'}
13、配置vscode
vscode -> 查看 -> 命令面板 -> Flutter: new project -> 输入项目名称 点击no device
flutter create app-name
找到main.dart文件,点击vscode右下方device