一、安装资料
可以去官网下载flutter,也可以通过git,下面俩个地址都可以
git clone -b alpha https://github.com/flutter/flutter.git
git clone https://github.com/flutter/flutter.git
下载完

二、配置环境变量
1.下载好fullter后,配置环境变量.bash_profile
vim ~/.bash_profile
2.添加刚下载的flutter文件bin目录
export PATH=/Users/Desktop/project/app/flutter/bin:$PATH
配置镜像
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
然后保存修改
source ~/.bash_profile
三、检查是否安装成功
1.在命令行输入flutter或flutter -h

2.输入flutter doctor,检查是否安装完毕

按刚检查结果查看,上图存在[!][x]的标示,表示检测不通过,需要过一些设置或安装相应的软件。
然后在命令行输入
flutter doctor --android-licenses
安装过程中会提示y/n,一直选择y

完成后,安装xcode
然后在进行brew安装方法:命令行输入
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装完毕。运行命令:
brew install --HEAD libimobiledevice
brew install ideviceinstaller
brew install ios-deploy
brew install cocoapods
pod setup
如果出现错误

可以运行
brew link --overwrite cocoapods
然后继续运行:
pod setup
如果觉得慢,也可以运行
cd ~/.cocoapods/repos
git clone https://github.com/CocoaPods/Specs.git
下载完成后,打开Android studio >preference>plugins ,安装flutter。

安装后重启Android studio,然后运行
flutter doctor
flutter doctor
这里有个坑,如果按照指引来做,会一直卡在这里。需要重新安装python
brew reinstall python@2
pip install six
再次运行
flutter doctor
到此,我们环境配置完成。

本文介绍了Flutter的安装与环境配置方法。可从官网或通过git下载Flutter,下载后配置环境变量。在命令行输入相关命令检查安装是否成功,根据检查结果进行相应设置或安装软件。安装过程中按提示选y,还需在Android studio中安装插件,遇到问题需重新安装python,最终完成环境配置。

2102

被折叠的 条评论
为什么被折叠?



