7

I am using Arctic Fox 2020.3.1 (ARM version- designed for Apple silicon), on Macbook Air M1 2020 model, running flutter project. I am successfully able to run on Android emulator, but when i try to run on attached iOS device or iOS simulator "pod install" command fails and build failed. But when i open my terminal on rosetta 2 and try "pod install" manually it install all pods, and after that i am able to run the build from XCODE but not from Android Studio, so my question is: Is terminal inside Android Studio runs on Apple (not on rosetta 2) that's why it fails.

Note: I have changed the configuration of terminal to run it forcefully on rosetta 2.

enter image description here enter image description here

This happens when i try to run for ios from studio

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
RussHWolf
  • 3,555
  • 1
  • 19
  • 26
Lakhwinder Singh
  • 6,799
  • 4
  • 25
  • 42
  • Try look at this ==> https://stackoverflow.com/a/66037887/16252358 – Tushar Patel Sep 21 '21 at 11:13
  • Run this command ==> arch -x86_64 pod install – Tushar Patel Sep 21 '21 at 11:15
  • if i need to run this command manually its ok, but when you press run button after selecting the iOS device then studio execute these commands by itself, so build failed, thanks for reply but not helpful @TusharPatel – Lakhwinder Singh Sep 21 '21 at 11:18
  • try to look at this article => https://medium.com/p-society/cocoapods-on-apple-silicon-m1-computers-86e05aa10d3e – Tushar Patel Sep 21 '21 at 11:20
  • I'm facing exactly the same issues, however I think the problem is with the latest XCode update. Try `flutter build ios --verbose` to see what exactly fails to build. – esentis Sep 21 '21 at 11:59
  • I am also having this problem with Android Studio on Apple Silicon when running Koltin Multiplatform project. – kaulex Oct 30 '21 at 10:42

2 Answers2

4

open Terminal type open ~/.zshrc (or .profile if you don't use zsh)

It seems that LANG="en_US.UTF-8" alone isn't enough, you have to set

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

type locale

You can now safely run pod update or pod install

UJJWAL
  • 1,231
  • 2
  • 7
  • 8
0

You may have to install ffi. Run sudo gem install ffi then normal flutter run should work as expected.

Kaushik Chandru
  • 15,510
  • 2
  • 12
  • 30