【问题标题】:Flutter: CocoaPods could not find compatible versions for pod "Firebase/Messaging"Flutter:CocoaPods 找不到 pod“Firebase/Messaging”的兼容版本
【发布时间】:2021-07-23 00:07:36
【问题描述】:

我正在尝试在 iOS 模拟器上运行 Flutter,在执行 flutter run 时出现下一个错误:

[!] CocoaPods 找不到 pod“Firebase/Messaging”的兼容版本: 在 Podfile 中: firebase_messaging(来自.symlinks/plugins/firebase_messaging/ios)被解析为9.1.3,这取决于 Firebase/消息 (= 7.11.0) 您的所有规范源都不包含满足依赖项的规范:Firebase/Messaging (= 7.11.0)

有人知道为什么会这样吗?

如果尝试会怎样:

  1. Flutter clean + flutter pug get
  2. 删除 de iOS 文件夹然后flutter create .
  3. 在 iOS 文件夹中删除 Pods 文件和 Podfile.dock 然后 pod init + pod install 导致同样的错误

我正在使用的包

  • cupertino_icons: ^1.0.2
  • cross_connectivity:^3.0.2
  • 加密:^3.0.1
  • device_info_plus:^1.0.1
  • 加密:^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
  • 图片:^3.0.2
  • image_picker:^0.7.4
  • 国际:^0.17.0
  • 位置:^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
  • 颤振 2.0.4
  • flutter doctor -v 结果 -> 全部为绿色

Github 上创建新问题之前,我更愿意在这里提问 如果这发生在其他人身上,那么我将在 Github 上创建一个新问题。

【问题讨论】:

  • 您尝试过 iOS 文件夹中的 pod update 吗?

标签: flutter dart cocoapods


【解决方案1】:

在使用带有 M1 芯片的 Mac 时可能会出现此问题。

首先解决“pod repo update”错误时会解决“CocoaPods could not find compatible versions for pod "Firebase/Messaging”错误。

我尝试了不同的解决方案,但对我有用的解决方案如下。 后续步骤:

  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 上提到了更多解决方案。

我终于在comment找到了我的。

【讨论】:

    【解决方案2】:

    我能够通过将目标 iOS 平台更新为 10.0 来解决类似的错误。将 Podfile 中配置的平台更新为platform :ios, '10.0'。我还必须将 iOS 部署目标更新为 10.0 - 位于 Runner > Info > Deployment Target

    之后,使用 rm -rf Podfile.lock 删除 Podfile.lock 然后运行 ​​pod updatepod install 为我解决了这个问题。

    【讨论】:

      【解决方案3】:

      您应该使用

      更新可可主存储库
      pod repo update
      

      然后

      pod install
      

      再次

      【讨论】:

        【解决方案4】:
        pod update Firebase/Messaging
        

        帮我搞定

        【讨论】:

          【解决方案5】:

          不要指定 firebase_messaging 版本

          firebase_messaging: // remove version from here 
          

          【讨论】:

            【解决方案6】:

            试试这个:

            firebase_core: null
            firebase_crashlytics: null
            firebase_messaging: null
            

            【讨论】:

            • 再次执行清理步骤后的事件: - Flutter clean + flutter pug get - 删除 de iOS 文件夹,然后 flutter create 。 - 在 iOS 文件夹中删除 Pods 文件和 Podfile.dock 然后 pod init + pod install
            • 即使在那之后。似乎问题是由“/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle - 中缺少兼容的拱门”引起的。在 iOs 文件夹上运行 pod repo update 时可以看到此错误。我仍在寻找解决方案。解决“pod repo update”错误后,我们将知道第一个问题是否解决。
            【解决方案7】:

            而不是 pod repo 更新

            arch -x86_64 pod install --repo-update

            【讨论】:

              猜你喜欢
              • 2022-08-09
              • 2021-07-20
              • 2021-12-14
              • 1970-01-01
              • 2021-05-07
              • 2021-04-01
              • 2019-09-27
              • 2022-11-02
              • 1970-01-01
              相关资源
              最近更新 更多