在Android Studio Arctic Fox Mac M1上,终端中无法运行"pod install"命令。

7
我正在使用针对苹果芯片设计的ARM版本的Arctic Fox 2020.3.1,在Macbook Air M1 2020型号上运行flutter项目。我成功地在Android模拟器上运行,但是当我尝试在连接的iOS设备或iOS模拟器上运行时,“pod install”命令失败并且构建失败。但是当我在rosetta 2上打开终端并手动尝试“pod install”时,它会安装所有的pods,之后我能够从XCODE运行构建,但无法从Android Studio运行构建,所以我的问题是:Android Studio内部的终端是否在Apple上运行(而不是在rosetta 2上),因此它失败了。
注意:我已经更改了终端的配置,强制其在rosetta 2上运行。

enter image description here enter image description here

当我尝试从Studio运行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

请查看此链接 ==> https://dev59.com/l1EG5IYBdhLWcg3wb9kL#66037887 - Tushar Patel
运行以下命令 ==> arch -x86_64 pod install - Tushar Patel
如果我需要手动运行此命令,那没问题,但是当您选择iOS设备后按下运行按钮时,工作室会自行执行这些命令,因此构建失败。感谢回复,但并没有帮助@TusharPatel。 - Lakhwinder Singh
请查看此文章 => https://medium.com/p-society/cocoapods-on-apple-silicon-m1-computers-86e05aa10d3e - Tushar Patel
我遇到了完全相同的问题,但我认为问题出在最新的XCode更新上。尝试使用“flutter build ios --verbose”命令查看具体构建失败的内容。 - esentis
我在使用 Kotlin 多平台项目时,在 Apple Silicon 上运行 Android Studio 也遇到了这个问题。 - kaulex
2个回答

4

打开终端并输入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


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

并不是真正的答案。 - kaulex

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接