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

Error when trying to run my Flutter App with my m1 mac

我每次尝试 运行 我的 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>'

错误运行ning pod install 在 iPhone 12 Pro Max.

上启动应用程序时出错

试试这个:

Cocoa Pods 安装在 M1

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

安装 ffi

  • sudo arch -x86_64 gem 安装 ffi

#更新仓库

  • arch -x86_64 pod install --repo-update

Flutter iOS 构建

  • 颤动干净
  • 颤动构建ios

在flutter工程的iOS文件夹中重新安装依赖[=​​41=]

  • arch -x86_64 pod 安装

follow this article 安装 coca-pods。我在 Macbook M1 上设置 flutter 时也遵循了这篇文章。

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

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