5

我添加firebase_analytics到我的 Flutter 应用程序中,它在 Android 上运行良好。当我去构建一个 iOS 版本时,我在使用 Codemagic 构建应用程序时遇到了一个模糊的错误。它似乎在本地构建好。

Fetching external sources
    -> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
    -> Fetching podspec for `firebase_analytics` from `.symlinks/plugins/firebase_analytics/ios`
    -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
    -> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`

    Resolving dependencies of `Podfile`
    [!] CocoaPods could not find compatible versions for pod "Firebase/Core":
      In snapshot (Podfile.lock):
        Firebase/Core (= 6.5.0)

      In Podfile:
        firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) was resolved to 0.0.1, which depends on
          Firebase/Core

    It seems like you've changed the constraints of dependency `Firebase/Core` inside your development pod `firebase_analytics`.
    You should run `pod update Firebase/Core` to apply changes you've made.

    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:257:in `process_topmost_state'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/resolver.rb:88:in `resolve'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/installer/analyzer.rb:939:in `block in resolve_dependencies'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/user_interface.rb:64:in `section'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/installer/analyzer.rb:937:in `resolve_dependencies'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/installer/analyzer.rb:118:in `analyze'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/installer.rb:398:in `analyze'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/installer.rb:221:in `block in resolve_dependencies'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/user_interface.rb:64:in `section'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/installer.rb:220:in `resolve_dependencies'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/installer.rb:156:in `install!'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/command/install.rb:51:in `run'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/command.rb:52:in `run'
    /Users/builder/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/cocoapods-1.7.5/bin/pod:55:in `<top (required)>'
    /Users/builder/.rbenv/versions/2.3.6/bin/pod:22:in `load'
    /Users/builder/.rbenv/versions/2.3.6/bin/pod:22:in `<main>'

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install
Application failed to start. Will not run test. Quitting.

我的 pubspec.lock 正确引用了最新版本的 firebase_analytics 和 firebase core:

  firebase_analytics:
    dependency: "direct main"
    description:
      name: firebase_analytics
      url: "https://pub.dartlang.org"
    source: hosted
    version: "4.0.2"
  firebase_core:
    dependency: "direct main"
    description:
      name: firebase_core
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.4.0+8"

而且我的 Podfile.lock 看起来并不太奇怪(以为我不知道我应该寻找什么:

PODS:
  - Firebase/Analytics (6.5.0):
    - Firebase/Core
  - Firebase/Core (6.5.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (= 6.0.4)
  - Firebase/CoreOnly (6.5.0):
    - FirebaseCore (= 6.1.0)
  - firebase_analytics (0.0.1):
    - Firebase/Analytics (~> 6.0)
    - Firebase/Core
    - Flutter
  - firebase_core (0.0.1):
    - Firebase/Core
    - Flutter
  - FirebaseAnalytics (6.0.4):
    - FirebaseCore (~> 6.1)
    - FirebaseInstanceID (~> 4.2)
    - GoogleAppMeasurement (= 6.0.4)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    - GoogleUtilities/MethodSwizzler (~> 6.0)
    - GoogleUtilities/Network (~> 6.0)
    - "GoogleUtilities/NSData+zlib (~> 6.0)"
    - nanopb (~> 0.3)
  - FirebaseCore (6.1.0):
    - GoogleUtilities/Environment (~> 6.0)
    - GoogleUtilities/Logger (~> 6.0)
  - FirebaseInstanceID (4.2.2):
    - FirebaseCore (~> 6.0)
    - GoogleUtilities/Environment (~> 6.0)
    - GoogleUtilities/UserDefaults (~> 6.0)
4

1 回答 1

0

由于pod update在这种情况下不起作用,请尝试以下步骤:

  1. 转到ios/Pods/Local Podspecs项目中的目录
  2. 检查每个 json 文件以找到所需的最高 ios 版本。您"ios": "10.0"在其中一些中找到的示例
  3. 回到 ios/ 目录
  4. 打开Podfile文件
  5. 取消注释# platform :ios, 'X.0'X.0代表您的 iOS 平台的版本。替换X.0为步骤 2 中的版本。例如:
    • # platform :ios, '9.0'>platform :ios, '10.0'
  6. 运行pod install,错误应该消失了
于 2021-11-01T16:26:02.930 回答