5

I added firebase_analytics to my Flutter app and it works great on Android. When I go to build an iOS version I get a vague error when I build the app using Codemagic. It seems to build OK locally.

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.

My pubspec.lock correctly references the most recent version of firebase_analytics and 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"

and my Podfile.lock doesn't look too strange (thought I don't know what I should be looking for:

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)
bamnet
  • 2,525
  • 17
  • 21
  • Try slightly lower version e.g. 0.4.0+3. At times, the system couldn't find the pod for a specific dart package and in my observation, a slightly lower version works. – Sukhi Aug 05 '19 at 03:59
  • Did you try `pod update`? – Paul Beusterien Aug 05 '19 at 16:55
  • Tried a `pod update`, no changes made to my Podfile.lock. – bamnet Aug 06 '19 at 05:19
  • 1
    Have you found any solution? – Ugurcan Yildirim Aug 26 '19 at 18:59
  • In your PodFile, have you seen this line `# Uncomment the next line to define a global platform for your project`? The next line looks like `# platform :ios, 'X.0'`? `X.0` represents the version of your iOS platform. Try to uncomment it, by just removing the `#`. Also check [the link](https://guides.cocoapods.org/syntax/podfile.html#platform) that was provided in the error. – MαπμQμαπkγVπ.0 Feb 19 '21 at 16:22

1 Answers1

0

Since pod update doesn't work in this case, try these steps:

  1. Go to ios/Pods/Local Podspecs directory in your project
  2. Check every json file to find highest required ios version. Example you've found "ios": "10.0" in some of them
  3. Go back to ios/ directory
  4. Open Podfile file
  5. Uncomment # platform :ios, 'X.0'. X.0 represents the version of your iOS platform. Replace X.0 with version from step 2. For example:
    • # platform :ios, '9.0' > platform :ios, '10.0'
  6. Run pod install and the error should be gone
MαπμQμαπkγVπ.0
  • 5,887
  • 1
  • 27
  • 65