🐛

Flutter: CocoaPods's specs repository is too out-of-date to satisfy de

2021/11/30に公開

エラー

Flutter ios buildでコケる。

$ flutter build ios \
    --dart-define APP_NAME=app_name \
    --dart-define APP_SUFFIX=.dev \
    --dart-define APP_ENV=dev 

CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Finding Podfile changes
      A firebase_crashlytics
      - Flutter
      - contact_picker
      - device_info
      - file_picker
      - firebase_auth
      - firebase_core
      - firebase_messaging
      - flutter_keyboard_visibility
      - flutter_local_notifications
      - flutter_webview_plugin
      - image_picker
      - path_provider
      - phone_number
      - share
      - shared_preferences
      - sqflite
      - url_launcher

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `contact_picker` from `.symlinks/plugins/contact_picker/ios`
    -> Fetching podspec for `device_info` from 
    
...


Error output from CocoaPods:
↳

    [!] Automatically assigning platform `iOS` with version `10.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: 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 11 Pro.

原因

CocoaPodsの設定が壊れてるぽい。

Well, basically your CocoaPods setup is going to break

https://stackoverflow.com/questions/64443888/flutter-cocoapodss-specs-repository-is-too-out-of-date-to-satisfy-dependencies

対応

stackoverflowの回答のとおりに、Podfile.lockを削除して、再度pod installし直したらbuildは通った。

# 1. Go to /ios folder inside your Project.
$ cd /ios

# 2. Delete Podfile.lock (YourPoject/ios/Podfile.lock)
$ rm Podfile.lock

# 3. Run pod install --repo-update (Make sure your cd into the iOS directory of the flutter app)
$ pod install --repo-update

# 4. Run flutter clean
$ flutter clean

# 5. Once complete, rebuild your Flutter application: flutter run
$ flutter run

※ ステップ3でcocoapodsのバージョンが古いと怒られたので、上げた。

$ sudo gem install cocoapods
...

$ pod --version
1.11.2

Discussion