0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Flutter】CocoaPods could not find compatible versionsを解決する

Posted at

発生したエラー

Flutterで開発中のアプリをiOSシミュレーターにデバッグビルドしようとしたら以下のエラーが発生。

Launching lib/main.dart on iPhone 15 Pro Max in debug mode...

                                    ~ 省略 ~

 [!] CocoaPods could not find compatible versions for pod "FirebaseAnalytics":
      In snapshot (Podfile.lock):
        FirebaseAnalytics (= 12.2.0)

      In Podfile:
        firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) was resolved to 12.0.4, which depends on
          FirebaseAnalytics (= 12.4.0)
2

    You have either:
     * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
     * changed the constraints of dependency `FirebaseAnalytics` inside your development pod `firebase_analytics`.
       You should run `pod update FirebaseAnalytics` to apply changes you've made.

                                    ~ 省略 ~

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update

Error running pod install
Error launching application on iPhone 15 Pro Max.

Exited (1).

エラーの詳細

着目するエラー文はこちら:

[!] CocoaPods could not find compatible versions for pod "FirebaseAnalytics":
      In snapshot (Podfile.lock):
        FirebaseAnalytics (= 12.2.0)

      In Podfile:
        firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) was resolved to 12.0.4, which depends on
          FirebaseAnalytics (= 12.4.0)

Flutterパッケージfirebase_analyticsが要求するPodのFirebaseAnalyticsバージョンは 12.4.0 となっているが、ios/Podfile.lockでは 12.2.0 になっていることで依存関係解決に失敗してしまったことが原因のようです。

あと、今回のログのように out-of-date ~ というログが出ているときは、Specsリポジトリをpod repo updateで更新しておきましょう。

解決方法

iOSライブラリとPodfile.lockを消してライブラリを入れ直します。
Flutterプロジェクト直下で以下のコマンドを実行します。

$ flutter clean
$ flutter pub get
$ cd ios
$ rm -rf Pods Podfile.lock
$ pod repo update
$ pod install

これでビルドが通るようになりました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?