尝试使用我的 m1 mac 运行我的 Flutter 应用程序时出错

Posted

技术标签:

【中文标题】尝试使用我的 m1 mac 运行我的 Flutter 应用程序时出错【英文标题】:Error when trying to run my Flutter App with my m1 mac 【发布时间】:2021-09-11 02:00:40 【问题描述】:

每次我尝试运行我的 Flutter 应用程序时都会收到以下错误。我确实尝试了很多来修复它,但仍然没有修复错误。

正在调试模式下在 iPhone 12 Pro Max 上启动 lib/main.dart... 正在运行 pod 安装... CocoaPods 的输出: ↳ 准备中

Analyzing dependencies

Inspecting targets to integrate
[!] Unable to find a target named `testing_gowtham` in project `Runner.xcodeproj`, did find `Runner`.

/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer/target_inspector.rb:108:in `compute_targets'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer/target_inspector.rb:40:in `compute_results'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1189:in `block (3 levels) in inspect_targets_to_integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1187:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1187:in `block (2 levels) in inspect_targets_to_integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1185:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1185:in `block in inspect_targets_to_integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:1180:in `inspect_targets_to_integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:106:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:414:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer.rb:160:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

运行 pod install 时出错 在 iPhone 12 Pro Max 上启动应用程序时出错。

【问题讨论】:

【参考方案1】:

试试这个:

M1 中的 Cocoa Pod 安装

sudo gem 安装 cocoapods sudo gem 安装 ffi arch -x86_64 sudo gem install cocoapods -n /usr/local/bin sudo gem install cocoapods -n /usr/local/bin

安装 ffi

sudo arch -x86_64 gem install ffi

#update repo

arch -x86_64 pod install --repo-update

Flutter iOS 构建

扑干净 flutter build ios

在flutter项目的iOS文件夹中重新安装依赖

arch -x86_64 pod install

【讨论】:

我已经完成了所有这些,现在我遇到了以下错误消息:/GeneratedPluginRegistrant.m:10:9: fatal error: module 'audioplayers' not found @import audioplayers; ~~^~~~~ 产生1个错误。注意:使用新的构建系统 注意:并行构建目标 注意:规划构建 注意:分析工作空间 注意:构建构建描述 注意:构建准备完成 无法为模拟器构建应用程序。【参考方案2】:

follow this article 安装 coca-pods。当我在我的 Macbook M1 上设置颤振时,我也会按照这篇文章进行操作。

-> 确保您已在终端中启用了rosetta(在下一篇文章中讨论)

https://medium.com/codex/simple-way-to-use-cocoapods-on-m1-ac9e22cf7e1c

【讨论】:

以上是关于尝试使用我的 m1 mac 运行我的 Flutter 应用程序时出错的主要内容,如果未能解决你的问题,请参考以下文章

M1 mac 进程不断自动生成并锁定我的端口

如何使用 M1 芯片在我的 Mac 上运行 pyqt5

M1 mac 无法运行 jboss/keycloak docker 镜像

M1 Mac - 启动 ElasticSearch 的问题。无法运行 jdk/bin/java

M1 Mac - 安装 pygame 2.0 [重复]

Docker-compose 在 M1 mac 上的 VM (Parallels) 中