当前位置: 首页 > news >正文

在Mac 上安装flutter 遇到的问题

准备工作

1、升级Macos系统为最新系统
2、安装最新的Xcode
3、电脑上面需要安装brew https://brew.sh/
4、安装chrome浏览器(开发web用)

下载Flutter、配置Flutter环境变量、配置Flutter镜像

下载Flutter SDK

https://docs.flutter.dev/release/archive?tab=macos
在这里插入图片描述
根据自己的电脑选择arm64或x64

  1. 查看CPU型号:可以通过查看CPU型号来区分CPU是ARM还是X86,ARM的CPU型号一般以“ARM”开头,而X86的CPU型号一般以“Intel”或“AMD”开头。

  2. 查看指令集:可以通过查看CPU支持的指令集来区分CPU是ARM还是X86,ARM支持的指令集一般是ARM指令集,而X86支持的指令集一般是x86指令集。

可以通过下面的命令查询:uname -a

~ % uname -a
Darwin PhoenixdeMBP 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64

把下载好的Flutter SDK随便减压到你想安装Sdk的目录如
/Users/phoenix/Documents/flutter_sdk/flutter

把 Flutter安装目录的bin目录配置到环境变量,然后把Flutter国内镜像也配置到环境变量里面

vim ~/.bash_profile
vim ~/.zshrc
export PATH=/Users/phoenix/Documents/flutter_sdk/flutter/bin:$PATH
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn			

里面的/Users/phoenix/Documents/flutter_sdk/flutter/bin,需要改为自己电脑的。在输入环境变量的时候,默认情况下是不可输的,需要按下ℹ️键,才可以输入。输入完成过后按下esc键、:键,输入wq退出。让配置环境变量生效。

flutter --version 如果能出来版本说明flutter sdk配置成功。
注意:如果配置完成后输入flutter --version告诉你flutter不是内置命令之类的错误的话,可能sdk没有配置成功,也可能sdk下载的时候没有下载全

运行flutter doctor 命令检测环境

第一次运行 flutter doctor的时候会提示下面错误

~ % flutter doctorYou have not agreed to the Xcode license agreements, please run 'sudo xcodebuild -license' from within a Terminal window to review and agree to the Xcode license agreements.
Building flutter tool...
Resolving dependencies... 
Got dependencies.
Failed to find the latest git commit date: VersionCheckError: Command exited with code 69: git -c log.showSignature=false log HEAD -n 1 --pretty=format:%ad --date=iso
Standard out: 
Standard error: 
You have not agreed to the Xcode license agreements, please run 'sudo xcodebuild -license' from within a Terminal window to review and agree to the Xcode license agreements.Returning 1970-01-01 08:00:00.000 instead.
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 0.0.0-unknown, on macOS 13.5.1 22G90darwin-arm64, locale zh-Hans-CN)! Flutter version 0.0.0-unknown on channel [user-branch] at/Users/phoenix/Documents/flutter_sdk/flutterCurrently on an unknown channel. Run `flutter channel` to switch to anofficial channel.If that doesn't fix the issue, reinstall Flutter by following instructionsat https://flutter.dev/docs/get-started/install.Cannot resolve current version, possibly due to local changes.Reinstall Flutter by following instructions athttps://flutter.dev/docs/get-started/install.! Upstream repository unknown source is not a standard remote.Set environment variable "FLUTTER_GIT_URL" to unknown source to dismissthis error.
[] 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/docs/get-started/install/macos#android-setupfor detailed instructions).If the Android SDK has been installed to a custom location, please use`flutter config --android-sdk` to update to that location.[!] Xcode - develop for iOS and macOS (Xcode 14.3.1)Xcode end user license agreement not signed; open Xcode or run the command'sudo xcodebuild -license'.Xcode requires additional components to be installed in order to run.Launch Xcode and install additional required components when prompted orrun:sudo xcodebuild -runFirstLaunch✗ CocoaPods not installed.CocoaPods is used to retrieve the iOS and macOS platform side's plugincode that responds to your plugin usage on the Dart side.Without CocoaPods, plugins will not work on iOS or macOS.For more info, see https://flutter.dev/platform-pluginsTo install seehttps://guides.cocoapods.org/using/getting-started.html#installation forinstructions.
[] Chrome - develop for the web
[!] Android Studio (not installed)
[] VS Code (version 1.80.0)
Error executing simctl: 69You have not agreed to the Xcode license agreements, please run 'sudo xcodebuild
-license' from within a Terminal window to review and agree to the Xcode license
agreements.[] Connected device (2 available)
[!] Network resources             ✗ An HTTP error occurred while checking "https://github.com/": Connectionclosed before full header was received! Doctor found issues in 5 categories.

这里如果这里没有安装 brew 的需要安装,安装方法可以参考
https://editor.csdn.net/md/?articleId=132603606

分根据报错信息分别执行下面命令

brew install cocoapods
pod setup
sudo xcodebuild -runFirstLaunch

在执行:brew install cocoapods报错

~ % brew install cocoapods
Error: You have not agreed to the Xcode license. Please resolve this by running:sudo xcodebuild -license accept

在这里是因为Xcode没有打开激活,只需要,打开Xcode,同意各种协议,即可在终端安装应用程序了。

依次执行:

brew install cocoapods
pod setup
sudo xcodebuild -runFirstLaunch

这次brew install cocoapods 成功了

再次执行:~ % flutter doctor 遇到下面的问题

An HTTP error occurred while checking "https://github.com/": Connectionclosed before full header was received

后面翻墙再次执行~ % flutter doctor

~ % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[] Flutter (Channel stable, 3.13.2, on macOS 13.5.1 22G90 darwin-arm64, localezh-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 SDKcomponents.(or visit https://flutter.dev/docs/get-started/install/macos#android-setupfor detailed instructions).If the Android SDK has been installed to a custom location, please use`flutter config --android-sdk` to update to that location.[] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[] Chrome - develop for the web
[!] Android Studio (not installed)
[] VS Code (version 1.80.0)
[] Connected device (2 available)
[] Network resources! Doctor found issues in 2 categories.

最后一个报错android studio官网下载软件就可以了
https://developer.android.google.cn/studio/

% flutter doctor                   
Doctor summary (to see all details, run flutter doctor -v):
[] Flutter (Channel stable, 3.13.2, on macOS 13.5.1 22G90 darwin-arm64, localezh-Hans-CN)
[] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[] Chrome - develop for the web
[] Android Studio (version 2022.3)
[] VS Code (version 1.80.0)
[] Connected device (2 available)
[] Network resources• No issues found!

你认真做好一件事,会解释所有事。O(∩_∩)O

相关文章:

在Mac 上安装flutter 遇到的问题

准备工作 1、升级Macos系统为最新系统 2、安装最新的Xcode 3、电脑上面需要安装brew https://brew.sh/ 4、安装chrome浏览器(开发web用) 下载Flutter、配置Flutter环境变量、配置Flutter镜像 下载Flutter SDK https://docs.flutter.dev/release/archive?tabmacos 根据自己…...

一个月能做什么?成长感悟分享

一个月做了什么? 八月做了些什么? 单词打卡 第一件事情就是单词打卡 英语很差的我,一样继续打卡,今天是第736天 当你还在纠结扇贝和不背、可可英语哪一个好的时候,别人已经同时使用了 当你还在咨询学编程、敲代码需…...

网络编程

1. 网络编程入门 1.1 网络编程概述 计算机网络 是指将地理位置不同的具有独立功能的多台计算机及其外部设备,通过通信线路连接起来,在网络操作系统,网络管理软件及网络通信协议的管理和协调下,实现资源共享和信息传递的计算机系统…...

ip route get ip地址 应用案例

应用场景 在做虚拟化实验用的虚拟机和实际的ECS云主机一般都会有多个网卡,网络的联通性是经常碰到的问题。比如在一个VM上有3个网卡,分别为ens160(和寄主机进行桥接的网卡10.0.0.128)、ens224(连接仅主机网络10.0.0.0/24的网卡10.0.0.128&…...

Windows下Redis的安装和配置

文章目录 一,Redis介绍二,Redis下载三,Redis安装-解压四,Redis配置五,Redis启动和关闭(通过terminal操作)六,Redis连接七,Redis使用 一,Redis介绍 远程字典服务,一个开源的,键值对形式的在线服务框架,值支持多数据结构,本文介绍windows下Redis的安装,配置相关,官网默认下载的是…...

【sgTransfer】自定义组件:带有翻页、页码、分页器的穿梭框组件,支持大批量数据的穿梭显示。

特性&#xff1a; 表格宽度可以自定义翻页器显示控件可以自定义列配置项可以设置显示字段列名称、宽度、字段名可以配置搜索框提示文本&#xff0c;支持搜索过滤穿梭框顶部标题可以自定义左右箭头按钮文本可以设置 sgTransfer源码 <template><div :class"$opti…...

分布式爬虫与SOCKS5代理池的组合优势

在数据驱动的时代&#xff0c;网络爬虫成为了获取大量信息的重要工具。然而&#xff0c;随着网站反爬策略的升级&#xff0c;传统的单机爬虫面临着速度慢、易被封禁等问题。为了应对这些挑战&#xff0c;我们可以尝试将分布式爬虫与SOCKS5代理池相结合&#xff0c;提高爬虫的性…...

京东获得JD商品详情 API 接口文档(含请求代码)

item_get-获得JD商品详情 API测试工具 注册开通 公共参数 名称类型必须描述keyString是调用key&#xff08;必须以GET方式拼接在URL中&#xff09;secretString是调用密钥api_nameString是API接口名称&#xff08;包括在请求地址中&#xff09;[item_search,item_get,item_sea…...

linux开启端口

目录 1.查看防火墙状态 1.1 开启防火墙 1.2 再次查看防火墙状态 2.开启指定端口 3. 重启防火墙 4.重新加载防火墙 5.查看已经开启的端口 1.查看防火墙状态 firewall-cmd --state 如果返回的是 not running&#xff0c;那么需要先开启防火墙&#xff0c; 1.1 开启防火…...

聚合多个电商API接口平台

API接口测试&#xff08;点击免费测试&#xff09; 随着数字化商业时代的到来&#xff0c;API接口已成为电商资源连接利器&#xff0c;也是全球传统互联网企业转型的基础。 2021年 Google Cloud 研究显示&#xff0c;全球互联网企业近3/4的企业持续投入数字化转型&#xff0c…...

4.2 实现基于栈的表达式求值计算器(难度4/10)

本作业主要考察&#xff1a;解释器模式的实现思想/栈结构在表达式求值方面的绝对优势 C数据结构与算法夯实基础作业列表 通过栈的应用&#xff0c;理解特定领域设计的关键作用&#xff0c;给大家眼前一亮的感觉。深刻理解计算机语言和人类语言完美结合的杰作。是作业中的上等…...

持续性能优化:确保应用保持高性能

在当今数字化时代&#xff0c;应用程序的性能已经成为用户体验和业务成功的关键因素之一。无论是Web应用、移动应用还是企业级软件&#xff0c;用户对于速度和响应性的要求越来越高。因此&#xff0c;持续性能优化已经成为保证应用在竞争激烈的市场中脱颖而出的重要策略。 什么…...

Jupyter installation Tutorial

文章目录 1. 面向的系统2. 什么是Jupyter&#xff1f;3. 安装Python环境4. 安装Jupyter notebook5. Jupyter的启动和配置6. Jupyter的使用技巧7. conclusion参考文献 1. 面向的系统 Windows安装 2. 什么是Jupyter&#xff1f; Jupyter Notebook是一个开源的Web应用程序&…...

css-定位position 理论

1.1网页常见布局方式 1.标准流 1.块级元素独占一行直布局 2.行内元素/行内块元素一行显示多个 ------>水平布局 2.浮动 1. 可以让原本垂直布局的 块级元素变成水平布局 3.定位 1. 可以让元素自由的摆放在网页的任意位置 2. 一般用于 盒子之间的层叠情况 1.2使用定位的步骤…...

软件测试规范

1、概述 本规范是对项目软件测试的一份指导性文件&#xff0c;对软件测试过程中所涉及到的测试理论、测试类型、测试方法、测试标准、测试流程以及软件产品开发单位所承担的职责进行总体规范&#xff0c;以有效保证软件产品的质量。 2、测试目的 测试的目的就是在软件交付前…...

Volatile 关键字提供的可见性

/*** 类说明&#xff1a;演示Volatile的提供的可见性*/ public class VolatileCase {// 说明&#xff1a;当ready没有volatile修饰时&#xff0c;执行结果是PrintThread线程一直处于被挂起状态&#xff0c;子线程感知不到主线程中的变量// 当ready被volatile修饰时&#xff0c;…...

Vue学习(三)

一、列表渲染 v-for指令 用于展示列表数据 语法<li v-for"(item, index) in items" :key"index"></li>key可以是index,最好是遍历对象的唯一标识 可遍历&#xff1a;数组、对象 <!DOCTYPE html> <html lang"en">&l…...

贝锐蒲公英异地组网路由器如何设置虚拟串口功能?

蒲公英虚拟串口功能&#xff0c;可实现智能组网内的其它成员异地调试此串口&#xff0c;无需到现场进行调试&#xff0c;为企业降低运营成本、便捷掌控设备数据。 1. 蒲公英硬件设置串口 进入蒲公英云管理平台&#xff0c;点击【工业应用】->【串口设置】&#xff0c;开启…...

MySQL 8.1.0 推出 InnoDB Cluster 只读副本

全面了解 8.1.0 版本新功能&#xff1a;InnoDB Cluster 只读副本的相关操作。 作者&#xff1a;Miguel Arajo 高级软件工程师 / Kenny Gryp MySQL 产品总监 本文来源&#xff1a;Oracle MySQL 官网博客 * 爱可生开源社区出品。 前言 MySQL 的第一个 Innovation 版本 8.1.0 已…...

java并发编程 PriorityBlockingQueue详解

文章目录 1 PriorityBlockingQueue是什么2 核心属性详解3 核心方法详解3.1 offer(E e)3.2 poll()3.3 take()3.4 peek() 4 总结 1 PriorityBlockingQueue是什么 PriorityBlockingQueue类上的注释描述&#xff1a;一个无界阻塞队列&#xff0c;它使用与类PriorityQueue相同的排序…...

Qwen3.5-9B-AWQ-4bitWeb界面使用教程:上传/提问/防重复提交/结果解析全流程

Qwen3.5-9B-AWQ-4bit Web界面使用教程&#xff1a;上传/提问/防重复提交/结果解析全流程 1. 认识Qwen3.5-9B-AWQ-4bit模型 Qwen3.5-9B-AWQ-4bit是一个强大的多模态AI模型&#xff0c;它能够同时理解图片和文字。想象一下&#xff0c;你有一个既会看图片又会回答问题的智能助手…...

Enhancing LLM Reasoning with Knowledge Graphs: A Faithful and Interpretable Approach

1. 为什么需要知识图谱增强LLM推理 最近两年&#xff0c;大型语言模型&#xff08;LLM&#xff09;的表现确实让人惊艳。我测试过GPT-4在代码生成、文案创作等场景的表现&#xff0c;效果确实超出预期。但当我尝试用LLM做知识密集型任务时&#xff0c;比如回答"贾斯汀比伯…...

8-Bit美学不妥协性能|像素剧本圣殿UI渲染与LLM推理资源隔离方案

8-Bit美学不妥协性能&#xff5c;像素剧本圣殿UI渲染与LLM推理资源隔离方案 1. 项目概述 像素剧本圣殿&#xff08;Pixel Script Temple&#xff09;是一款专为剧本创作者设计的AI辅助工具&#xff0c;基于Qwen2.5-14B-Instruct大模型深度微调开发。它将高性能AI推理能力与独…...

【数据结构】数组与特殊矩阵

数据结构的学习中&#xff0c;数组与特殊矩阵是基础且核心的内容。它们不仅是程序设计中最常用的线性结构&#xff0c;更是处理复杂矩阵运算的基础。本文将结合解析与真题&#xff0c;带你彻底搞懂数组的存储方式和特殊矩阵的压缩存储技巧。一、一维数组与二维数组&#xff1a;…...

30天小白进阶AI大神:收藏这份路线图,免费工具玩转大模型!

本文为AI学习新手提供了30天的系统学习路线图&#xff0c;涵盖了AI技术栈的三个层次&#xff1a;应用层、模型层和基础设施层。文章建议从应用层入手&#xff0c;逐步向下理解&#xff0c;并推荐了主流AI工具的对比及免费工具的入门使用。此外&#xff0c;还提供了给初学者的五…...

CasRel在智能问答系统中的落地实践:为QA引擎注入结构化事实支撑

CasRel在智能问答系统中的落地实践&#xff1a;为QA引擎注入结构化事实支撑 1. 引言&#xff1a;当问答系统遇到关系抽取 想象一下这样的场景&#xff1a;用户向智能问答系统提问"苹果公司的CEO是谁&#xff1f;"&#xff0c;系统需要快速准确地回答"蒂姆库克…...

告别图形界面!用DM数据库的dlsql命令行工具,5分钟搞定日常数据库运维

命令行利器dlsql&#xff1a;DM数据库高效运维实战指南 在数据库运维的世界里&#xff0c;图形化界面固然直观&#xff0c;但真正的高手往往更青睐命令行工具带来的高效与灵活。DM数据库的dlsql命令行客户端&#xff0c;就是这样一把被许多DBA私藏的"瑞士军刀"。 1. …...

为什么92%的团队在MCP项目中期被迫重构?Python 4大模板的抽象泄漏、协议耦合与测试盲区深度拆解

第一章&#xff1a;MCP服务器开发模板的行业现状与重构困局当前&#xff0c;MCP&#xff08;Model Control Protocol&#xff09;服务器作为AI智能体协同调度与协议网关的核心组件&#xff0c;在金融风控、工业边缘控制、多模态Agent编排等场景中加速落地。然而&#xff0c;主流…...

新手福音:基于预置镜像,在快马平台零配置开启Python Web开发之旅

作为一个刚接触Python Web开发的新手&#xff0c;我最近在InsCode(快马)平台上体验了一把零配置搭建个人博客的过程。不得不说&#xff0c;这种基于预置镜像的开发方式&#xff0c;简直是为我们这些初学者量身定制的福音。下面我就来分享一下这次的学习心得。 为什么选择预置镜…...

嵌入式状态机设计与实现全解析

1. 嵌入式状态机基础概念状态机&#xff08;State Machine&#xff09;是嵌入式系统开发中最核心的设计模式之一&#xff0c;它通过定义系统可能处于的状态集合、状态之间的转换条件以及状态转换时执行的动作&#xff0c;为复杂系统行为建模提供了清晰框架。在嵌入式环境中&…...