[小ネタ]CodemagicでFlutterのiOSビルド時`CocoaPods is installed but broken`で失敗する
エンジニアをやっている福本です!
今日はFlutterの小ネタを書きます。花粉症なので。
起きたこと
FlutterのCI/CDツールCodemagicで、CD内のBuilding iOS
パイプラインで以下のエラーが発生し、ビルドに失敗した。
Warning: CocoaPods is installed but broken. Skipping pod install.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods.
To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
CocoaPods not installed or not in valid state.
Build failed :|
Failed to build for iOS
どうもCocoapodsが壊れとる??特にiOSビルド周りのコードや依存関係をイジった記憶もなく、心当たりがないので困り果てました。ローカルのCocoapodsも壊れてないしなあ...。
Tl;Dr
Application setting > Build
の設定で、Cocoapodsのバージョン指定をdefault
にしたらOKです。なんじゃそりゃあ!!
※変更前は、プロジェクトで使っているCocoapodsのバージョン(1.16.0
)をちゃんと指定していました
試したこと
activesupportのgemバージョンを指定
ググってみると、Cocoapodsで上記のエラーに関するissueがあった。そこで解決策として示されているgem 'activesupport', '~> 7.0.8'
とactivesupportのバージョン指定を Gemfile
に明示的に書きました。
CDを再実行してみましたが、変わらず...。
とりあえずCocoaPodsの再インストール
エラーログにThis can usually be fixed by re-installing CocoaPods
とあるので、素直にCocoapods入れ直したりしてみるかあ...と思ってこのあたりを一通り実行しました👇️
$ sudo gem uninstall cocoapods
$ sudo gem install cocoapods
$ pod install
$ pod cache clean --all
pod updateしたらios/Podfile.lock
に差分が出たりしたけど、特に関係なく同じエラーに...。(以下の記事などを参考にさせていただきました)
default
に
[解決]Cocoapodsのバージョン指定を困ってCodemagicのissueを漁りまくっていたところ、それらしいissueに出会いました👇️
「Please try using the default/pre-installed Cocoapods version 」と書いてあり、「そんなのに騙されないぞ!」と思いつつ実行すると、無事ビルドが成功しました。少し時間溶かしてしまった...。
原因はよくわからないんですが、issueのコメント見るにCodemagicの不具合のような雰囲気を受けました(違ったらごめんなさい🙏)
I can reproduce this issue, but it seems like there are some incompatibility issues, and I can see similar issues raised in some repositories.(いくつかの非互換性の問題があるようで、いくつかのリポジトリで同様の問題が提起されているのを見ることができます)
Discussion