Danny
Danny

Reputation: 506

Getting "CocoaPods could not find compatible versions for pod "Firebase/Database" " Error on flutter

i have followed an exact guide on how to setup a geofire on to my project. i have success on my android project.. but i cant get it to run for the ios.. and it has the following error as i try to run it.

[!] CocoaPods could not find compatible versions for pod "Firebase/Database":
  In Podfile:
    firebase_database (from `.symlinks/plugins/firebase_database/ios`) was resolved to 6.1.2, which depends on
      Firebase/Database (= 7.11.0)

    flutter_geofire (from `.symlinks/plugins/flutter_geofire/ios`) was resolved to 0.0.1, which depends on
      GeoFire (~> 4.0) was resolved to 4.1.0, which depends on
        Firebase/Database (~> 6.0)

I've tried to run pod update and this is the result

Macbook-MBP:ios Macbook$ pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
firebase_auth: Using Firebase SDK version '7.11.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '7.11.0' defined in 'firebase_core'
firebase_database: Using Firebase SDK version '7.11.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "Firebase/Database":
  In Podfile:
    firebase_database (from `.symlinks/plugins/firebase_database/ios`) was resolved to                             
    6.1.2, which depends on Firebase/Database (= 7.11.0)

    flutter_geofire (from `.symlinks/plugins/flutter_geofire/ios`) was resolved to 0.0.1,
     which depends on
  GeoFire (~> 4.0) was resolved to 4.1.0, which depends on
    Firebase/Database (~> 6.0)

and this is what i've imported to my pubspec.yaml file..

  firebase_database: ^6.1.2
  flutter_geofire: ^2.0.0

i dont understand what im doing wrong, any help would be appreciated.. thanks

Upvotes: 4

Views: 6418

Answers (5)

Ogbu Ezekiel Ike
Ogbu Ezekiel Ike

Reputation: 1

This worked for me 1 - flutter clean 2 - flutter run

Upvotes: 0

user21385113
user21385113

Reputation: 1

copy and replace your file with below codes. It should works.

# Uncomment this line to define a global platform for your project
  platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'GeoFire', :git => 'https://github.com/mrdishant/geofire-objc'

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

Upvotes: 0

Proches Vara
Proches Vara

Reputation: 1

Faced the same challenge but all of the above solutions didn't work for me. What worked for me:

  1. Following the link shown in the error (I've highlighted): enter image description here

  2. In you IDE, go to Project File -> ios -> .symlinks -> plugins -> firebase_database -> ios enter image description here

  3. Open the .podspec file of the dependency. enter image description here

  4. Look for: s.ios.deployment_target = '12.0'

  5. I think the "s.ios.deployment_target" should be less than or equal to the "platform :ios, 'XX.0'" in the Podfile. enter image description here

  6. After changing s.ios.deployment_target value to less than in the platform :ios, in the podfile, try removing Podfile.lock, pod install --repo-update etc.

  7. Do the same for other podfiles throwing the error, in your case: flutter_geofire, firebase_database etc.

  8. You can check this solution too. [https://stackoverflow.com/questions/65881232/specs-satisfying-the-firebase-admob-but-they-required-a-higher-minimum-deploy]

Upvotes: 0

Omatt
Omatt

Reputation: 10529

Updating the platform configured in the Podfile to platform :ios, '10.0' didn't work for me. I've had to update the iOS Deployment Target to 10.0 - located on Runner > Info > Deployment Target

Xcode iOS Deployment Target

After that, deleting the Podfile.lock with rm -rf Podfile.lock then running pod update and pod install solved the issue for me.

Upvotes: 1

Danny
Danny

Reputation: 506

for anyone that is facing this issue,

  1. run flutter clean in the terminal
  2. add this line at the bottom of the podfile
    pod 'GeoFire', :git => 'https://github.com/mrdishant/geofire-objc', :tag => '4.3.0'
  3. dont forget to add use_frameworks! on top of the podfile
  4. delete Pod folder from iOS.
  5. change platform :ios, '10.0' to platform :ios, '11.0' on the podfile
  6. run pod repo update then pod update
  7. then run flutter run in the terminal

thats how i got it working for me

Upvotes: 5

Related Questions