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,運行成功!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章