flutter for Mac 配置遇到的问题及解决办法

Flutter是谷歌的移动UI框架,可以快速在iOS和Android上构建高质量的原生用户界面。 Flutter可以与现有的代码一起工作。在全世界,Flutter正在被越来越多的开发者和组织使用,并且Flutter是完全免费、开源的。

Flutter中文网:https://flutterchina.club

1、获取Flutter SDK 下载地址
2、配置环境变量

在cmd下执行:

open .bash_profile

在bash_profile文件添加以下

#Add the flutter tool to your path
#export PATH="$PATH:pwd/flutter/bin"
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Applications/flutter/bin:$PATH

注意/Applications/flutter为你的存放flutter文件夹的路径。
保存cmd下再执行

source ~/.bash_profile

3、查看是否完成

运行以下命令查看是否需要安装其它依赖项来完成安装:

flutter doctor

在这里插入图片描述

嘿嘿 有几个问题,我们依次解决
【1】、Android toolchain - develop for Android devices (Android SDK version 28.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
–android-licenses
本机已安装了AndroidSDK,Android许可不被接受,需要执行以下命令,同意许可

flutter doctor --android-licenses

---------------------------------------
Accept? (y/N): y
All SDK package licenses accepted

【2】、Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS
development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
本机已安装了xcode,那就是需要执行以下命令

cmd
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license

再执行一下,看看这两个问题解决了没

flutter doctor

在这里插入图片描述

ok,已解决,继续解析以下问题
【3】、Android Studio (version 3.4)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
本机已安装Android Studio,但是缺这两个插件,需要我们去安装一下。
打开Android Studio ->configure->Plugins
搜索flutter 进行install
在这里插入图片描述

搜索dart 进行install
在这里插入图片描述

【4】Connected device
! No devices available
本机连接设备,可忽略

再执行一下

flutter doctor

在这里插入图片描述

红叉问题都已解决

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值