cocoapods
firebase
cloud_firestore
flutter
dependency-management

CocoaPods could not find compatible versions for pod Firebase/Core” cloud_firestore, Flutter

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

This CocoaPods error means the iOS dependency constraints declared by your Flutter plugins do not overlap. In Firebase setups, this often happens when firebase_core and cloud_firestore plugin versions are out of sync or local pod metadata is stale. The fix is version alignment first, then clean iOS resolution with minimal manual pinning.

Understand the Constraint Chain

In Flutter, plugin versions are resolved by pub, then each plugin brings iOS pod constraints through its podspec. CocoaPods tries to satisfy all those constraints at once.

A conflict appears when one plugin requires a Firebase pod range that another plugin cannot accept. Editing random pod versions in Podfile can hide the root issue and make upgrades harder later.

Start with the Flutter layer, not CocoaPods overrides.

Align Flutter Firebase Plugins Together

List current dependency graph:

bash
flutter pub deps | grep firebase
flutter pub outdated

Then upgrade related Firebase plugins as a group in pubspec.yaml, not one package at a time. After update:

bash
flutter pub get

Check pubspec.lock and verify firebase_core and cloud_firestore are from compatible release families.

Refresh iOS Resolution State

After Flutter alignment, rebuild iOS pod resolution from a clean but controlled state:

bash
1cd ios
2pod repo update
3rm -rf Pods
4rm -f Podfile.lock
5pod install --verbose

If the error persists, read the exact conflicting version lines from CocoaPods output. Map each pod back to the plugin version in pubspec.lock so you know which package is driving the constraint.

Keep Podfile Minimal and Modern

Use a modern iOS platform target that current Firebase plugins support. Avoid aggressive manual pinning unless absolutely required.

ruby
1platform :ios, '13.0'
2
3target 'Runner' do
4  use_frameworks!
5  use_modular_headers!
6end

Too many hardcoded pod versions in Podfile can fight the plugin-tested combinations and create recurring conflicts.

Use Temporary Overrides Carefully

Sometimes you need a short-term override to unblock. If so, document it and remove it once plugin versions catch up.

ruby
# temporary compatibility pin
pod 'Firebase/CoreOnly', '10.29.0'

After adding any override, run full app validation on device and simulator. A successful install is not enough if runtime initialization breaks.

Validate Runtime Integration After Resolution

Once pod install succeeds:

bash
cd ..
flutter clean
flutter run

Then verify Firebase initialization and one Firestore read or write path. Dependency resolution can succeed while runtime setup fails due to incorrect app configuration files or platform settings.

Add CI Guardrails

Prevent recurring conflicts by ensuring Flutter and iOS lock state move together in pull requests.

Example CI sequence:

bash
flutter pub get
cd ios
pod install --deployment

If pubspec.lock changed but Podfile.lock is stale, fail the build and request lockfile refresh. This catches drift early.

Troubleshooting Flow That Avoids Random Changes

Use this order:

  1. Check Firebase plugin version compatibility in Flutter.
  2. Refresh pub get and inspect lockfile.
  3. Re-resolve pods with updated specs.
  4. Add temporary pin only if absolutely needed.
  5. Remove temporary pin when upstream compatibility is available.

Sticking to this order reduces trial-and-error loops and keeps your dependency graph maintainable.

Common Pitfalls

  • Upgrading cloud_firestore without upgrading related Firebase plugins.
  • Pinning many pod versions manually and diverging from plugin support matrix.
  • Skipping pod repo update and resolving against stale metadata.
  • Keeping too old iOS deployment target for current plugin requirements.
  • Stopping at install success without runtime Firebase validation.

Summary

  • The error is a constraint mismatch across Flutter plugins and CocoaPods.
  • Solve at the Flutter plugin layer first, then re-resolve iOS pods.
  • Keep Podfile minimal and avoid long-term manual pod pins.
  • Rebuild lock state cleanly and verify runtime Firebase behavior.
  • Add CI checks so dependency drift is caught before merge.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions