繁体   English   中英

无法设置 cocoapods。Cocoapods 设置问题

[英]unable to setup cocoapods. Cocoapods setup problem

我正在尝试运行连接到 Firebase 的 flutter 应用程序,但是当我尝试在 iOS 模拟器上运行它时,它会显示这些错误 -

警告:CocoaPods 已安装但未初始化。 跳过 pod > 安装。 CocoaPods 用于检索 iOS 和 macOS 平台端的>插件代码,该代码响应您在 Dart 端的插件使用情况。 如果没有 CocoaPods,插件将无法在 iOS 或 macOS 上运行。 有关详细信息,请参阅https://flutter.dev/platform-plugins要初始化 CocoaPods,请运行:pod setup 一次以完成 CocoaPods 的安装。

然后我做了“pod setup”但是它显示了这个错误:

Cloning into 'master'...
remote: Enumerating objects: 14707, done.        
remote: Counting objects: 100% (14707/14707), done.        
remote: Compressing objects: 100% (14117/14117), done.        
error: RPC failed; curl 18 transfer closed with outstanding read data 
remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

对我来说,这是由于 cocoapods 版本。 您可以在终端中使用它:

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.7.5
pod setup

此问题的解决方法在这里: https : //github.com/flutter/flutter/issues/41253

还有这里: https : //flutter.dev/docs/get-started/install/macos#deploy-to-ios-devices

(我使用的是 macOS Catalina JIC)

现在应该使用 flutter 版本v1.9.1+hotfix.5及更高版本v1.9.1+hotfix.5

尝试卸载所有现有的 cocoapods 安装:

sudo gem uninstall cocoapods
brew uninstall cocoapods

然后安装最新版本的cocoapods:

sudo gem install cocoapods
pod setup

我可以确认这适用于 macOS Catalina v10.15.4上的 flutter 1.12.13+hotfix.9 (稳定通道),cocoapods 版本1.9.1

sudo gem install cocoapods -v 1.10.0 -n /usr/local/bin

在您的终端中运行命令(例如,不在 AndroidStudio 中):

sudo gem install cocoapods
pod setup

之后,运行:

flutter build ios

更新 Flutter 版本后,面临同样的问题。

尝试installing and uninstalling cocoapods ,仍然是同样的问题。

最后,这个问题为我解决了。

如果您使用的是 Android Studio

File -> Invalidate Caches -> Invalidate and Restart

我连续几天都在与这个问题作斗争。 对我来说,问题只是当我使用带有 M1 芯片的 Mac 时。 最初,当我尝试将音频播放器包添加到我的项目时出现此错误。 经过一周的搜索,我遇到了这个解决方案,在此处输入链接描述<\/a>

在我需要使用地理定位包并且问题再次出现之前,它工作得很好。 经过几天尝试不同的解决方案,我终于找到了适合我的解决方案。 我使用 brew 重新安装了 cocoapods。 完成后,我关闭了终端,关闭了 android studio,然后在终端打开 \/Applications\/Android\\ Studio.app 上运行以下命令。 Pod 现在安装没有问题,我的项目在 iOS 上启动。

在 flutter 中,我通过打开带有终端的 android 工作室解决了这个问题

在您的终端上使用此行

open /Applications/Android\ Studio.app

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM