3

I am having a rather weird day. I get this error whenever I try to run my app on iOS simulator from Android Studio

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

export LANG=en_US.UTF-8

At this point on Xcode, I begin to get the error

Error: "The sandbox is not in sync with the Podfile.lock..."

when I try to build on Xcode. However, I am able to build successfully on Xcode and run on my emulator after the following fixes

 1. $pod deintegrate --verbose
 2. $pod install --verbose

Going back to Android Studio, I get my initial error again and so I keep going in circles

flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.2.0, on macOS 11.2.3 20D91 darwin-x64, locale en-NG) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS [✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [!] Android Studio ✗ Unable to find bundled Java version. [✓] Android Studio (version 4.1) [✓] IntelliJ IDEA Community Edition (version 2021.2.1) [✓] Connected device (1 available)

6 Answers 6

15

just change your cocoapos version to 1.10.2 to solve your problem.

first uninstall your current version (whatever it is)

In my case, i downgraded from version 1.11.1

sudo gem uninstall cocoapods

Then just install the stable version (as of Nov 11, 2021)

sudo gem install cocoapods:1.10.2

and build your app again.

If still not working , delete the below from the build directory:

  • Podfile
  • Podfile.lock
  • Pods (directory)

and build.

It fixed it for me, twice in the last few days.

Sign up to request clarification or add additional context in comments.

1 Comment

you saved may life
5

Solving Cocoapods UTF-8 error: (Detailed explanation)

We need to change the locale of the terminal to UTF-8.

Step 1: Open the terminal, type locale, press enter, and check what locale it shows.

Step 2: If it's a bash terminal, change it to a zsh terminal,

Step 3: Then open finder, go to mac HD, users, folder with your username, and press command+shift+. to open hidden files

Step 4: Create or open a file named .zshrc

Step 5: Paste this there:

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

Step 6: Save it by command + s

Step 7: Then open the terminal again and check by typing, locale and pressing enter (Then you can either keep it open or close the terminal)

Step 8: If it shows some other locale instead of UTF-8, then paste the below 3 lines and press enter:

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

Step 9: Then open Android Studio, go to the terminal and paste the same above 3 lines, and press enter

Step 10: Then on your project file, go to the ios folder, right-click on it, and open in the terminal, then in the terminal, do paste the same above 3 lines and press enter

Step 11: Now you can install pods in this terminal by typing, pod install.

Now it will work, if you still get the same error, go to tools -> flutter -> flutter clean and restart android studio by clicking on File -> restart ide or a similar one.

Then on your project, right-click on the ios folder and open the terminal, type locale, and press enter, if it's not in UTF-8 now, then from step 9 again up to step 11, it will work now. You can run your app on iOS devices now.

My repo -> https://github.com/anantha-eswar/

1 Comment

This only worked for me when I added quotes, so "en_US.UTF-8", not en_US.UTF-8.
0

After trying every solution I could lay my hands on, I figured it was a problem with Android studio and I fixed by completely uninstalling and reinstalling AS

Comments

0

I have had this issue and just fixed by downgrading the version of cocoapods to 1.10.2

Comments

0

If you're using fish shell, do the following:

  1. Open config.fish in the the .config/fish/ directory

  2. Add the following command

set -Ux LC_ALL en_US.UTF-8
  1. Call source config.fish to apply changes. Or open a new tab.

That's all. It works on my machine.

Comments

0

After trying everything to no avail, I discovered that you need to surround the en_US.UTF-8 in QUOTES, so:

export LC_ALL="en_US.UTF-8"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.