Mac电脑:Flutter开发环境配置小白教程
1.进入官网下载页:
https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
可以看到有 Windows 、 macOS、 Linux 三种系统的下载包
点击macOS,然后点击下载 Stable channel (稳定版)中的最新版本,可以放先在桌面上,然后移到资源库Library中;
2.下载得到一个Flutter文件或者压缩包(解压缩即可),然后点击“访达”-“资源库”,把包拖到资源库;
3.app store 下载Xcode;
4.配置Path变量环境:
4.1 打开终端 Terminal,
然后输入
vi ~/.bash_profile
可能会报:
证明这个文件已经存在了,关闭终端重新打开,输入:open -e .bash_profile
open -e .bash_profile
然后在文件中添加:(如果 bash_profile无法编辑,输入 i 进入可编辑状态 )
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=你的flutter的存放路径/flutter/bin:$PATH
如果按照我的操作来的话,
export PATH=你的flutter的存放路径/flutter/bin:$PATH
其实就是:
export PATH=/Library/flutter/bin:$PATH
保存,退出( Esc : wq 保存退出)
4.2 执行下面这行命令,生效当前文件
source ~/.bash_profile
(如果你是用的是zsh,请参考https://www.jianshu.com/p/f9abb844e9b1中的这一步)
4.3 运行 flutter/bin 命令,验证目录是否在已经在PATH中:
echo $PATH
结果如下:
(注意:如果没有.bash_profile 文件,可以参考:https://blog.csdn.net/huxinguang_ios/article/details/78709428 创建)
4.4
执行 以下命令
flutter doctor
查看是否需要安装其它依赖项来完成安装。
如果在执行 flutter doctor 命令后,报如下错误
Error: The Flutter directory is not a clone of the GitHub project.The flutter tool requires Git in order to operate properly;to set up Flutter, run the following command:git clone -b stable https://github.com/flutter/flutter.git
那么就删除刚才的安装包,然后cd 到你需要安装flutter文件夹的文件中,然后执行以下代码,重新下载
git clone -b stable https://github.com/flutter/flutter.git
漫长的等待...
然后再执行 flutter doctor
wsdeMacBook-Pro:Flutter ws$ flutter doctor
Downloading Dart SDK from Flutter engine 2994f7e1e682039464cb25e31a78b86a3c59b695...% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed
100 200M 100 200M 0 0 435k 0 0:07:51 0:07:51 --:--:-- 288k
Building flutter tool...╔════════════════════════════════════════════════════════════════════════════╗║ Welcome to Flutter! - https://flutter.dev ║║ ║║ The Flutter tool uses Google Analytics to anonymously report feature usage ║║ statistics and basic crash reports. This data is used to help improve ║║ Flutter tools over time. ║║ ║║ Flutter tool analytics are not sent on the very first run. To disable ║║ reporting, type 'flutter config --no-analytics'. To display the current ║║ setting, type 'flutter config'. If you opt out of analytics, an opt-out ║║ event will be sent, and then no further information will be sent by the ║║ Flutter tool. ║║ ║║ By downloading the Flutter SDK, you agree to the Google Terms of Service. ║║ Note: The Google Privacy Policy describes how data is handled in this ║║ service. ║║ ║║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and ║║ crash reports to Google. ║║ ║║ Read about data we send with crash reports: ║║ https://github.com/flutter/flutter/wiki/Flutter-CLI-crash-reporting ║║ ║║ See Google's privacy policy: ║║ https://www.google.com/intl/en/policies/privacy/ ║╚════════════════════════════════════════════════════════════════════════════╝Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this
source!
Downloading Material fonts... 1.7s
Downloading Gradle Wrapper... 0.1s
Downloading android-arm-profile/darwin-x64 tools... 2.3s
Downloading android-arm-release/darwin-x64 tools... 3.3s
Downloading android-arm64-profile/darwin-x64 tools... 5.6s
Downloading android-arm64-release/darwin-x64 tools... 4.2s
Downloading android-x64-profile/darwin-x64 tools... 7.8s
Downloading android-x64-release/darwin-x64 tools... 2.6s
Downloading package sky_engine... 1.0s
Downloading common tools... 19.0s
Downloading common tools... 8.7s
Downloading darwin-x64 tools... 48.2s
Downloading libimobiledevice... 0.3s
Downloading usbmuxd... 0.2s
Downloading libplist... 0.2s
Downloading openssl... 1.6s
Downloading ideviceinstaller... 0.1s
Downloading ios-deploy... 0.2s
Downloading libzip... 0.1s
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G103, locale zh-Hans-CN)
[✗] Android toolchain - develop for Android devices✗ Unable to locate Android SDK.Install Android Studio from: https://developer.android.com/studio/index.htmlOn first launch it will assist you in installing the Android SDK components.(or visit https://flutter.dev/setup/#android-setup for detailed instructions).If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.You may also want to add it to your PATH environment variable.[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[!] Android Studio (not installed)
[!] Connected device! No devices available! Doctor found issues in 3 categories.
4.5然后再执行 以下命令查看配置
flutter doctor -v
执行结果
wushuangdeMacBook-Pro:Flutter wushuang$ flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G103,locale zh-Hans-CN)• Flutter version 1.12.13+hotfix.5 at/Users/wushuang/Library/Flutter/flutter• Framework revision 27321ebbad (4 weeks ago), 2019-12-10 18:15:01 -0800• Engine revision 2994f7e1e6• Dart version 2.7.0[✗] Android toolchain - develop for Android devices✗ Unable to locate Android SDK.Install Android Studio from:https://developer.android.com/studio/index.htmlOn first launch it will assist you in installing the Android SDKcomponents.(or visit https://flutter.dev/setup/#android-setup for detailedinstructions).If the Android SDK has been installed to a custom location, setANDROID_HOME to that location.You may also want to add it to your PATH environment variable.[✓] Xcode - develop for iOS and macOS (Xcode 11.3)• Xcode at /Applications/Xcode.app/Contents/Developer• Xcode 11.3, Build version 11C29• CocoaPods version 1.8.3[!] Android Studio (not installed)• Android Studio not found; download fromhttps://developer.android.com/studio/index.html(or visit https://flutter.dev/setup/#android-setup for detailedinstructions).[✓] Connected device (1 available)• iPhone 11 Pro Max • 5477F382-441E-4FA4-AE1F-D8EB63B5AA3E • ios •com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)! Doctor found issues in 2 categories.
发现其中有“Android toolchain - develop for Android devices”前面有个红色 [x],其实只要保证Xcode 和 Android toolchain 有一个成功就行,当然也可以再下载补全
5
5.1 安装 homebrew(如果已经安装homebrew就跳过)
可以点击homebrew 进去官网查看下载链接,也可以在Terminal 中执行
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
5.2 打开Terminal 然后逐条运行这些命令来安装用于将Flutter应用安装到iOS设备的工具
brew update
brew install --HEAD libimobiledevice
brew install ideviceinstaller ios-deploy cocoapods
pod setup
又是经过漫长的下载... (如果卡在 brew update这里,可以control+c终止,继续下一步就行了)
最后结果
至此,大功告成!
参考链接:
https://www.jianshu.com/p/f9abb844e9b1
https://www.jianshu.com/p/20519f2f0d36
https://www.jianshu.com/p/fb78a2b127df
Mac电脑:Flutter开发环境配置小白教程相关推荐
- Mac电脑PHP开发环境配置
其实具体步骤不是很麻烦,主要就是Mac的那些权限问题比较恶心.笔者已经详细的写了解决办法.请按照步骤一步一步来吧~ 需要什么? 安装 web 服务器: 安装 PHP: 安装数据库,比如Navigate ...
- Mac电脑机器视觉开发环境配置
1.Qt的安装 Qt的安装与win和ubuntu的安装大同小异,都是下载安装包,然后安装就可以了,这个过程中可能会提示安装XCode,直接同意就可以了.之后的启动和运行类似于ubuntu,都是通过命令 ...
- 第一篇Mac上fluter开发环境配置
第一篇Mac上fluter开发环境配置 一.安装Xcode 二.安装Android studio 1.下载并安装[下载android studio](https://developer.android ...
- Deepin Linux上的Android+Flutter开发环境配置
Deepin Linux上的Android+Flutter开发环境配置 在Linux上安装Flutter开发环境,官方教程参见Flutter Get Started,中国用户被墙需额外注意的官方教程参 ...
- WindowsXP/7/10 Python3.6.3开发环境配置图文教程
WindowsXP/7/10 Python3.6.3开发环境配置图文教程 一.内容: 操作系统:WindowsXP/7/10 1.Python3.6.3安装及环境配置 2.pip安装方式以及升级到最 ...
- Mac VScode C++开发环境配置
Mac VScode C++开发环境配置 一 需要安装的模块 C/C++C/C++ Clang Command AdapterCode RunnerCodeLLDB 二 配置文件 c_cpp_prop ...
- flutter git 拉不起来_「干货」Flutter开发环境配置备忘录
为什么要用Flutter? 嗯,本篇文章不会讲,因为我认为想看这篇文章的应该已经下定决心要学习Flutter. Flutter开发环境支持安装在Windows.Mac OS和Linux下,区别在于Wi ...
- Flutter开发环境配置
文章目录 前言 一.打开Flutter官网 二.安装和环境配置 1.查看中国网络环境下使用flutter这篇文章 2.Mac上设置 3.Windows上设置 4.AndroidStudio插件安装 前 ...
- mac flutter 开发环境配置 从0到1 流程
本文首发简书,本人为原作者,转至掘金 转载请注明出处 原文连接 掘金连接 https://www.jianshu.com/p/c55ad0e8f24f 高能提示:文章字数不多,图很多,请做好战斗准备 ...
- Mac上Java开发环境配置
作者:干物多田 链接:https://www.zhihu.com/question/29114464/answer/153345290 来源:知乎 著作权归作者所有.商业转载请联系作者获得授权,非商业 ...
最新文章
- isk麦克风安装教程_得胜麦克风怎么样?isk的麦克风怎么样?屁颠虫麦克风使用教程?得胜PC电容麦克风详细拆解...
- java越权发送邮件_已登录用户 越权 访问action方法怎么解决?
- 森林病虫防治系统 (十一)
- lg gram 笔记本 linux,lg gram 15笔记本使用雨林木风u盘安装win7系统教程?
- 利用反射获得类的public static/const成员的值
- linux elf 视频,linux 实例讲解elf文件
- 数据中台的使命、愿景、本质和六大核心能力
- 小汤学编程之MySQL(二)——数据库操作、表结构操作、表数据操作、查询数据和数据类型
- Geohash介绍及针对具体需求的改良
- 清华姚班和100个“张小龙” | 中国AI天才养成计划
- 2021概率论与数理统计辅导讲义-余丙森
- c语言.jpg图片转成数组_怎么把Word转成PDF?一个PDF转换软件就能搞定!
- Proxmox 平台上快速部署 DoraCloud桌面云系统
- UG NX 12 组合投影曲线
- 小米是否真的可以干翻华为?
- 三星android强制关机,三星怎么强制关机
- pip或pip3安装报错Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming。。。
- AUSBC3.0, 震撼来袭!(UVC Camera,支持开启多路摄像头)
- openwrt U盘安装php,db120电信猫刷机openwrt15.05.1系统,建站软件调试、u盘全过程
- 大数据时代,揭露个人数据泄漏和秘密跟踪内幕