Flutter安装图解
2022-11-19 10:29 jiangys 阅读(2545) 评论(0) 编辑 收藏 举报官方安装Flutter教程:https://docs.flutter.dev/get-started/install/macos
但是不是很全,现在按照下面的步骤进行安装操作。
Flutter中文学习文档: https://flutter.cn/docs
1、先下载flutter sdk
下载地址:https://docs.flutter.dev/development/tools/sdk/releases?tab=macos#macos
![](https://img2022.cnblogs.com/blog/292326/202211/292326-20221119010542579-644532187.png)
将下载的flutter解压到/Users/[用户名]/Sdk
下面
2、安装android studio
下载地址:https://developer.android.google.cn/studio/
下载好DMG包之后安装好Android Studio,然后进行插件安装
![](https://img2022.cnblogs.com/blog/292326/202211/292326-20221119011400215-963245588.png)
3、安装flutter插件
分别安装Dart 和 Flutter插件
![](https://img2022.cnblogs.com/blog/292326/202211/292326-20221119085007560-1175772939.png)
android studio 安装配置完成
配置flutter环境变量
1、下载的flutter解压到/Users/[用户名]/Sdk
下面
2、终端中打开环境配置文件
vim ~/.bash_profile
输入"i",编辑文件并输入以下内容
export PATH=/Users/jiangys/flutter/bin:$PATH export ANDROID_HOME="/Users/jiangys/Library/Android/sdk" export PATH=${PATH}:${ANDROID_HOME}/tools export PATH=${PATH}:${ANDROID_HOME}/platform-tools export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
说明:PATH=/Users/jiangys/flutter/bin:$PATH ,这里的路径就是下载的flutter解压的路径,千马别放错了哦。
接着按shift+:wq保存并退出vim。
接着输入如下命令:
source ~/.bash_profile
验证一下flutter环境有没有配置成功,输入:
flutter -h
看到如下如的打印信息就是配置成功了
![](https://img2022.cnblogs.com/blog/292326/202211/292326-20221119102622904-1610875717.png)
flutter doctor
![](https://img2022.cnblogs.com/blog/292326/202211/292326-20221119111342376-827669902.png)
红叉叉表示需要配置到东西
cmdline-tools component is missing 解决:
![](https://img2022.cnblogs.com/blog/292326/202211/292326-20221119111817802-1833384850.png)
Some Android licenses not accepted. To resolve this, run: flutter doctor--android-licenses
直接输入下面命令解决
flutter doctor --android-licenses
CocoaPods not installed.
直接在控制台输入:
sudo gem install cocoapods
重新运行,已经全部运行成功
![](https://img2022.cnblogs.com/blog/292326/202211/292326-20221119112752544-772284916.png)
遇到的问题
![](https://img2022.cnblogs.com/blog/292326/202211/292326-20221119120113483-954124867.png)
运行Flutter
flutter create -t module flutter_module
android studio 打开刚创建的项目,选择iphone 13,点击运行
运行结果