Flutter Warning: CocoaPods not installed. Skipping pod install.

报错

flutter项目在运行到ios 模拟器的时候报错:

Warning: CocoaPods not installed. Skipping pod install.

还有

Using new build systemnote: Planning buildnote: Constructing build descripti....
Xcode’s output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
Debug.xcconfig line 1: Unable to find included file "Pods/Target Support
Files/Pods-Runner/Pods-Runner.debug.xcconfig"
Debug.xcconfig line 1: Unable to find included file “Pods/Target Support
Files/Pods-Runner/Pods-Runner.debug.xcconfig”
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
ld: framework not found Flutter
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Could not build the application for the simulator.
Error launching application on iPhone XR.

具体报错没记录,一开始也没想着会有这么麻烦。


提示

官方给出了两个提示执行命令:

brew install cocoapods
pod setup

这个其实在一开始配环境执行flutter doctor的结果之后也给了提示,也是配置mac环境的条件。
但是本来项目是可以运行到ios模拟器的,新项目也是可以运行的,但是最近项目改动较多,无从查起,没办法只能硬着头皮解决了。

在网上搜了一圈,并没有相关的解决方案,没办法,站不了巨人的肩上了,只能自己摸索了。


思路一

按照指示在终端执行brew install cocoapods,等了好一会,开始出现下载

==> Downloading https://homebrew.bintray.com/bottles/cocoapods-1.7.5.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/5a/5a70fd60007975ce224824b1a8852ba9124faa6753061d0ecc024be4cebd6e8b?__gda__=exp=1565624237~hmac=b87d5d0111b49f600da053951890

下载到百分之几的时候就失败了,然后又重试,结果在百分之六十多的时候又失败了,应该是要fq,国内速度较慢。

然后又开始在网上搜CocoaPods的安装教程,搜了一圈下来,看着都麻烦。


思路二

然后我尝试在Android Studio自带的terminal中直接执行brew install cocoapods,默认是在项目根目录执行的,

yechaodeMacBook-Pro:wanandroid_flutter yechao$ brew install cocoapods

会有error提示

Error: Another active Homebrew update process is already in progress.
Please wait for it to finish or terminate it to continue.

但是可以下载,而且速度挺快的,

==> Downloading https://homebrew.bintray.com/bottles/cocoapods-1.7.5.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/5a/5a70fd60007975ce224824b1a8852ba9124faa6753061d0ecc024be4cebd6e8b?__gda__=exp=1565624237~hmac=b87d5d0111b49f600da053951890
######################################################################## 100.0%

下载完成之后在执行 pod setup,又是一顿下载,这个要等一会了。

yechaodeMacBook-Pro:wanandroid_flutter yechao$ pod setup
Setting up CocoaPods master repo
  $ /usr/local/bin/git clone https://github.com/CocoaPods/Specs.git --progress -- master
  Cloning into 'master'...
  remote: Enumerating objects: 260, done.        
  remote: Counting objects: 100% (260/260), done.        
  remote: Compressing objects: 100% (249/249), done.        
  Receiving objects:  10% (361304/3368611), 72.04 MiB | 57.00 KiB/s  

完了之后再次尝试运行到ios模拟器,

ok,运行成功!


发布了246 篇原创文章 · 获赞 441 · 访问量 68万+

猜你喜欢

转载自blog.csdn.net/yechaoa/article/details/99356997