8

I created a new KMM project and selected Cocoapods for the iOS framework distribution and as soon as it finished building it threw the following error:

Executing of 'pod install' failed with code 1. Error message:

Please, check that file "/Users/barryalan/AndroidStudioProjects/PersonalProjects/deleteThis/iosApp/Podfile" contains following lines in header: source 'https://cdn.cocoapods.org'

Please, check that each target depended on shared contains following dependencies:

I can't complain given this is still in alpha, but I do need some guidance on how to fix this.

barryalan2633
  • 367
  • 2
  • 11

6 Answers6

8
  1. Open terminal.cd into the iosApp directory. type sudo gem install cocoapods / gem install cocoapods
  • After successful pod generation close the terminal and android studio.
  • open terminal again and run this command sudo gem install cocoapods-generate / gem install cocoapods-generate Close and reopen the terminal again and continue with step 2.
  1. Type vim .zshrc in your terminal. This should open up your .zshrc profile. Type I to insert something. Then, simply paste in export LANG=en_US.UTF-8 and hit ESC to get out and then type :wq to save and quit.
  • Quit terminal open and open Android Studio. Clean and build your project.
Danny
  • 89
  • 4
8

2022 UPDATE

How to run CocoaPods on Apple Silicon (M1) (credit goes to commenter Jakub Turcovsky)

Original post

Had a similar issue on M1 (Apple Silicon) Mac. It asked for dependencies but didn't tell which had been missing. Just the error code was different:

Executing of 'pod install' failed with code 134

After installing the cocoapods (and generate), I had to update ruby for M1 (see How to run CocoaPods on Apple Silicon (M1))

sudo arch -x86_64 gem install ffi

In the KMM project I ran (within the iosApp folder):

arch -x86_64 pod install

Shared dependency has been installed

/iosApp ❯ arch -x86_64 pod install                                                                                              
Analyzing dependencies
Downloading dependencies
Installing shared (1.0)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

After that, the project has been sync properly.

FYI:

  • Android Studio Arctic Fox | 2020.3.1 Patch 4 (arm64)
  • VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. - Homebrew (openjdk@11)
  • macOS 12.1
peter.o
  • 3,194
  • 6
  • 49
  • 74
2

Could you provide the full error message, which dependencies are missing? Also your setup.

You can also run pod install from cmd, if that works as expected it might be a locale issue as cocoapods now enforces UTF-8 and the process running the build might be using a different one

Róbert Nagy
  • 5,058
  • 18
  • 39
0

Make sure cocoapods installed The easiest way to install cocoapods:

$ brew install cocoapods

Install with command below mine get error:

$ sudo gem install cocoapods
0

If you are running M1 and using the cocoapods installed from homebrew, the error should not be linked to your arch like other solutions suggest.

Instead, cd to the iosApp and run pod install manually from android studio terminal. Note: It must be the android studio terminal because your local terminal may give you a false positive result.

If the error shown is

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

export LANG=en_US.UTF-8 

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

add

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

save and exit

Go back to Terminal and type source ~/.zshrc

Quit your Android studio instance (cmd + Q) and reopen again, issue should be fixed!

Robin
  • 407
  • 3
  • 10
-1

None of the above answers worked for me.

Switching Android Studio > Preferences > Embedded JDK (previously was set to Android Studio java home) fixed my issue.

I previously tried adding "source 'https://cdn.cocoapods.org'" to the top of my Podfile, but this didn't make a difference.

zetatlas
  • 205
  • 2
  • 5