Flutter: CocoaPods无法找到与pod“Firebase/Messaging”兼容的版本

10
我正在尝试在iOS模拟器上运行flutter,但在执行flutter run时出现以下错误:
[!] CocoaPods找不到与“Firebase / Messaging”兼容的版本: 在Podfile中: firebase_messaging(来自.symlinks / plugins / firebase_messaging / ios)已解决为9.1.3,其依赖于 Firebase / Messaging(= 7.11.0) 您的规范来源中没有包含满足依赖关系的规范:Firebase / Messaging(= 7.11.0)
有人知道这是为什么吗?
我尝试过以下方法:
1. Flutter clean + flutter pug get 2. 删除iOS文件夹,然后flutter create . 3. 在iOS文件夹中删除Pods文件和Podfile.dock,然后pod init + pod install,导致相同的错误
我使用的软件包:
  • cupertino_icons:^1.0.2
  • cross_connectivity:^3.0.2
  • crypto:^3.0.1
  • device_info_plus:^1.0.1
  • encrypt:^5.0.0
  • firebase_analytics:^8.0.2
  • firebase_core:^1.1.0
  • firebase_crashlytics:^2.0.2
  • firebase_messaging:^9.1.3
  • flutter_barcode_scanner:^2.0.0
  • flutter_card_swipper:^0.4.0
  • flutter_easyloading:^3.0.0
  • flutter_local_notifications:^5.0.0+1
  • flutter_speed_dial:^3.0.5
  • fluttertoast:^8.0.3
  • http:^0.13.2
  • image:^3.0.2
  • image_picker:^0.7.4
  • intl:^0.17.0
  • location:^4.1.1
  • mime_type:^1.0.0
  • path_provider:^2.0.1
  • permission_handler:^6.1.3
  • shared_preferences:^2.0.4
  • sqflite:^2.0.0+3
  • url_launcher:^6.0.3
  • webview_flutter:^2.0.4

配置

  • iOS 部署目标 12.1
  • Flutter 2.0.4
  • flutter doctor -v 结果 -> 所有绿色

我更喜欢在这里提问,而不是在 Github 上创建一个新问题。如果其他人也遇到了这个问题,那么我将在 Github 上创建一个新问题。


你尝试过在iOS文件夹中执行pod update吗? - mgonzalez
7个回答

16

当使用M1芯片的Mac时,可能会出现此问题。

解决“CocoaPods could not find compatible versions for pod "Firebase/Messaging”错误之前,需要先解决“pod repo update”错误。

我尝试了不同的解决方案,但对我有效的是以下步骤:

  1. 在终端中运行:sudo arch -x86_64 gem install ffi
  2. 在ios项目文件夹中运行:arch -x86_64 pod install --repo-update,而不是pod repo update(在此步骤之前,如果有必要,请删除Podfile.lock)
  3. 现在您的构建应该成功了,请按F5。

Github上提到了更多解决方案。

我最终在这个评论中找到了我的解决方案。


它对我来说显然是有效的。 - Ramazan Sağır

4
你应该使用以下命令更新 Cocoa 主库存储库:
pod repo update

然后。
pod install

再次


3

我曾经遇到类似的错误,通过将目标iOS平台更新到10.0得以解决。请在Podfile中更新配置的平台为platform: ios,'10.0'。此外,还需要将iOS部署目标更新为10.0,位于Runner > Info > Deployment Target下。

Xcode iOS Deployment Target

之后,用rm -rf Podfile.lock删除Podfile.lock文件, 然后运行 pod updatepod install即可解决我的问题。


1
pod update Firebase/Messaging

修复了我


0

不要指定firebase_messaging的版本。

firebase_messaging: // remove version from here 

0

使用 arch -x86_64 pod install --repo-update 命令代替 pod repo update


-2

试试这个:

firebase_core: null
firebase_crashlytics: null
firebase_messaging: null

在执行清理步骤后,再次触发事件:
  • Flutter clean + flutter pug get
  • 删除iOS文件夹,然后flutter create。
  • 在iOS文件夹中删除Pods文件和Podfile.dock,然后执行pod init + pod install。
- Younss AIT MOU
即使如此,问题似乎是由于“/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle中缺少兼容的架构”引起的。在iOs文件夹上运行pod repo update时会出现此错误。我仍在寻找解决方案。在解决“pod repo update”错误后,我们将知道第一个问题是否已解决。 - Pol

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接