问题场景
在Android Studio中运行Flutter项目,设备为IPhone,点击Run后,编译出现以下错误
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install:
sudo gem install cocoapods
CocoaPods not installed or not in valid state.
解决方法
方法1
发现通过在Xcode中打开ios目录运行正常,或者使用flutter run ios也能正常编译。
怀疑是Android Studio没有正确识别CocoaPods。
目前我使用的是Android Studio Arctic Fox,将版本升级到Android Studio Bumblebee,再次使用run运行到ios就能正常使用了。
方法2
如果方法1无效,那我们需要手动设置。
pod setup
brew link --overwrite cocoapods