发表日期:2018-05 文章编辑:小灯 浏览次数:2723
本文详细介绍在mac下配置flutter环境的每一个步骤,通过图文的方式使得读者快速理解和掌握flutter的环境搭建流程。
推荐去官网下载,速度并不慢,网址:
https://flutter.io/setup-macos/
点击链接:
笔者在写这篇文章时候的链接为:
https://storage.googleapis.com/flutter_infra/releases/beta/macos/flutter_macos_v0.3.2-beta.zip
先把刚才下载的flutter_macos_v0.3.2-beta.zip解压缩,笔者选择使用的目录是根目录下的app文件夹
配置环境变量,这里笔者使用命令行:
vim ~/.bash_profile
增加一行:
export PATH=/app/flutter/bin:$PATH
保存一下,注意如果这个文件不存在,那么就新建一个。保存完毕之后运行命令:
source ~/.bash_profile
这个时候应该能运行flutter命令了,我们运行命令行:
flutter -h
这个时候应该能展示flutter的命令帮助:
运行命令行:
flutter doctor
按照检测结果的说明,如果有[!] ✗ 标志,表示本行检测不通过,需要做一些设置或者安装一些软件。
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
! Some Android licenses not accepted.To resolve this, run: flutter doctor --android-licens
需要运行
flutter doctor --android-licens
这里界面会要求输入Y/N,一路输入Y就行了。
✗ ideviceinstaller is not installed; this is used to discover connected iOS devices.
To install, run:
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.io/platform-plugins
To install:
brew install cocoapods
pod setup
运行命令:
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
如果还是太慢,那么去
链接:https://pan.baidu.com/s/1mQ1VvslwwccdoLRi-I0pNg密码:lax1
下一份,解压缩到~/.cocoapods/repos/master目录
[✓] Android Studio (version 3.0)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
打开android studio, 打开plugin
输入flutter搜索,点击中间的 Search in repositories
点击install,顺利的话安装完毕之后重启android studio
再次运行
flutter doctor
注意这里有个坑,如果按照指引来做,会一直卡在这里。这里要先重装一下python,运行下面的命令:
brew reinstall python@2 pip install six
再次运行
flutter doctor
至此,我们的环境就搭建完毕了,可以愉快的开发了。如果还有疑问,那么可以加入qq群854192563 我们一起探讨。
日期:2018-10 浏览次数:7540
日期:2018-12 浏览次数:4620
日期:2018-07 浏览次数:5133
日期:2018-12 浏览次数:4414
日期:2018-09 浏览次数:5772
日期:2018-12 浏览次数:10193
日期:2018-11 浏览次数:5105
日期:2018-07 浏览次数:4854
日期:2018-05 浏览次数:5115
日期:2018-12 浏览次数:4580
日期:2018-10 浏览次数:5390
日期:2018-12 浏览次数:6457
日期:2018-11 浏览次数:4714
日期:2018-08 浏览次数:4867
日期:2018-11 浏览次数:12959
日期:2018-09 浏览次数:5877
日期:2018-12 浏览次数:5093
日期:2018-10 浏览次数:4438
日期:2018-11 浏览次数:4790
日期:2018-12 浏览次数:6318
日期:2018-06 浏览次数:4263
日期:2018-08 浏览次数:5711
日期:2018-10 浏览次数:4698
日期:2018-12 浏览次数:4815
日期:2018-07 浏览次数:4628
日期:2018-12 浏览次数:4801
日期:2018-06 浏览次数:4635
日期:2018-11 浏览次数:4617
日期:2018-12 浏览次数:4545
日期:2018-12 浏览次数:5527
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.