5

我在 Macbook Air M1 2020 型号上使用 Arctic Fox 2020.3.1(ARM 版本 - 为 Apple 芯片设计),运行颤振项目。我成功地能够在 Android 模拟器上运行,但是当我尝试在附加的 iOS 设备或 iOS 模拟器上运行时,“pod install”命令失败并且构建失败。但是当我在 Rosetta 2 上打开终端并手动尝试“pod install”时,它会安装所有 pod,之后我可以从 XCODE 但不能从 Android Studio 运行构建,所以我的问题是:Android Studio 内的终端是否运行在 Apple 上(不是在 Rosetta 2 上),这就是它失败的原因。

注意:我已更改终端的配置以在 Rosetta 2 上强制运行它。

在此处输入图像描述 在此处输入图像描述

当我尝试从工作室运行 ios 时会发生这种情况

The plugins `flutter_full_pdf_viewer, flutter_webview_plugin, onesignal_flutter` use a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Launching lib/main.dart on Lakhwinder’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: E942NB2Q9L
Running pod install...
CocoaPods' output:
↳
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update

Error output from CocoaPods:
↳
        WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
        Consider adding the following to ~/.profile:

        export LANG=en_US.UTF-8
        
    /opt/homebrew/Cellar/ruby/3.0.2/lib/ruby/3.0.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:30:in `report'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:66:in `report_error'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/bin/pod:23:in `load'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/bin/pod:23:in `<main>'
    /opt/homebrew/Cellar/ruby/3.0.2/lib/ruby/3.0.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:205:in `podfile'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:46:in `run'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/bin/pod:23:in `load'
        from /opt/homebrew/Cellar/cocoapods/1.11.2/libexec/bin/pod:23:in `<main>'

Exception: Error running pod install
4

2 回答 2

2

打开终端类型open ~/.zshrc(如果不使用 zsh,则为 .profile)

看来LANG="en_US.UTF-8"光有还不够,还要设置

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

保存文件

返回终端

类型source ~/.zshrc

类型locale

您现在可以安全地运行pod updatepod install

于 2021-12-10T18:28:02.860 回答
0

您可能需要安装 ffi。运行sudo gem install ffi然后正常的颤振运行应该按预期工作。

于 2021-10-30T19:07:44.817 回答