Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
正在运行 pod install... CocoaPods 的输出: ↳ CDN: trunk 相对路径:CocoaPods-version.yml 存在!返回本地,因为检查仅在回购更新中执行
CocoaPods 的错误输出: ↳ 警告:CocoaPods 要求您的终端使用 UTF-8 编码。 考虑将以下内容添加到 ~/.profile:
export LANG=en_US.UTF-8
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `unicode_normalize'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `installation_root'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:226:in `podfile_path'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface/error_report.rb:30:in `report'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:66:in `report_error'
from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:52:in `run'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:23:in `load'
from /usr/local/bin/pod:23:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `unicode_normalize'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `installation_root'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:226:in `podfile_path'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:205:in `podfile'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command/install.rb:46:in `run'
from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:52:in `run'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:23:in `load'
from /usr/local/bin/pod:23:in `<main>'
运行 pod install 时出错 在 iPhone 12 Pro Max 上启动应用程序时出错。
这似乎是 Cocoapods v 1.11.0 中的一种错误/不兼容问题
为了解决这个问题,我按照以下步骤操作,效果非常好:https://stackoverflow.com/a/69076515/16881741
简单地说,请按照以下步骤操作:
在终端的 ios 文件夹中输入
gem list --local | grep cocoapods
记下上一个命令的输出是什么。看起来像这样(请忽略各个条目附近的版本,这是我的输出,我已经使用版本 1.10.1):
cocoapods (1.10.1)
cocoapods-core (1.10.1)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)
sudo gem uninstall X
将“X”替换为 cocoapods 组件的名称(不带版本)。
最后你应该得到这个:sudo gem uninstall cocoapods
sudo gem uninstall cocoapods-core
sudo gem uninstall cocoapods-deintegrate
sudo gem uninstall cocoapods-downloader
sudo gem uninstall cocoapods-plugins
sudo gem uninstall cocoapods-search
sudo gem uninstall cocoapods-trunk
sudo gem uninstall cocoapods-try
确保包含第 n.1 点中列出的所有组件,以避免脏状态
sudo gem install cocoapods -v 1.10.1
获取正确的版本。感谢我在顶部链接的答案的作者 Esteban Lopez。
此问题出现在 Cocoapods 1.11.0 中,许多人已经注意到回滚到 1.10.2 修复了该问题。但最初的问题来自于终端中设置的错误区域设置。它必须是基于 UTF-8 的语言环境。
这里的第二个答案为我解决了这个问题。
如前所述,运行即可
export LC_ALL=en_US.UTF-8
在您的终端中,错误应该会消失。考虑将其添加到您的
.zshrc
文件中,以便它在每个会话中自动发生。
打开终端
export LC_ALL=en_US.UTF-8
这将解决您的问题。
尝试使用默认
pod install
terminal
。
这对我有用:
flutter clean,
delete /iOS/Pods,
delete /iOS/Podfile.lock,
flutter build ios.
我的 Mac 版本信息:
CocoaPods : 1.11.0
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
RubyGems : 3.0.3
Host : macOS 11.5.2 (20G95)
Xcode : 12.5.1 (12E507)
Git : git version 2.23.0
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
在 VCode 上运行相同的项目并且成功运行,猜测问题出在我的 Android Studio 上。
升级 Ruby 是解决此问题的另一种方法。