简体   繁体   English

"在 iOS 中运行颤振应用程序时出错"

[英]Getting error while run flutter app in iOS

Launching lib/main.dart on iPhone 12 Pro Max in debug mode...

It seems that is a sort of bug/incombatibility issue in Cocoapods v 1.11.0这似乎是 Cocoapods v 1.11.0 中的一种错误/不兼容问题

To fix the issue, I followed these steps and it worked like a charm: https://stackoverflow.com/a/69076515/16881741为了解决这个问题,我按照以下步骤操作,它就像一个魅力: https : //stackoverflow.com/a/69076515/16881741

Briefly, follow these steps:简而言之,请按照以下步骤操作:

  1. In your terminal, in ios folder type在您的终端中,在 ios 文件夹类型中

    gem list --local | grep cocoapods

  2. Take note of what is the output of the previous command.记下上一个命令的输出是什么。 It looks like that (please ignore the version near the various entry, this is my output and I already use the version 1.10.1):看起来像这样(请忽略各个条目附近的版本,这是我的输出,我已经使用了 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)

  1. One by one, launch the command sudo gem uninstall X substituting the "X" with the name of the cocoapods component, without the version.一一启动命令sudo gem uninstall X用 cocoapods 组件的名称替换“X”,不带版本。 At the end you should obtain this:最后你应该得到这个:

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

Be sure to have included all the component listed in the point n.1 to avoid dirty status确保已包含第 n.1 点中列出的所有组件以避免脏状态

  1. Use the command sudo gem install cocoapods -v 1.10.1 To obtain the correct version.使用命令sudo gem install cocoapods -v 1.10.1来获取正确的版本。

All kudos to Esteban Lopez, the author of the answer I linked at the top.我在顶部链接的答案的作者埃斯特班·洛佩兹 (Esteban Lopez) 的所有荣誉。

This worked for me:这对我有用:

flutter clean,
delete /iOS/Pods,
delete /iOS/Podfile.lock,
flutter build ios.

my Mac version info:我的 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 上。

This issues appeared in Cocoapods 1.11.0 and as many already noticed rolling back to 1.10.2 fixes the issue.这个问题出现在 Cocoapods 1.11.0 中,很多人已经注意到回滚到 1.10.2 修复了这个问题。 But the original issue comes from wrong locale set in the terminal.但最初的问题来自终端中设置的错误区域设置。 It has to be a UTF-8-based locale.它必须是基于 UTF-8 的语言环境。

The second answer in here solved the issue for me.在第二个答案在这里解决了这个问题对我来说。

As stated, just run如上所述,只需运行

export LC_ALL=en_US.UTF-8

in your terminal, and the error should go away.在您的终端中,错误应该会消失。 Consider adding this to your .zshrc file so that it happens automatically in every session.考虑将其添加到您的.zshrc文件中,以便它在每个会话中自动发生。

open Terminal type open ~/.zshrc (or .profile if you don't use zsh)打开终端类型open ~/.zshrc (或 .profile 如果您不使用 zsh)

It seems that LANG="en_US.UTF-8" alone isn't enough, you have to set看来光是LANG="en_US.UTF-8"还不够,还得设置

export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

save the file保存文件

go back to Terminal返回终端

type source ~/.zshrc输入source ~/.zshrc

type locale输入locale

You can now safely run pod update or pod install您现在可以安全地运行pod updatepod install

升级 Ruby 是解决此问题的另一种方法。

"

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

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