4

Yesterday I updated my Mac with Android Studio Bumblebee 2021.1.1 hoping that it would solve multiplatform issues I encounter.

Below some screenshots about my Mac and versions to be 100% clear:

Android Studio Bumblee About

macOs Monterey 12.2 iMac details

xCode 13.2.1 versions

Kotlin Multiplaform Mobile version

When I create a new KMM Application project I get errors. These are the steps (I can't post all screenshots): Basically accepting all default settings and followed by the final step:

New Project Step 3

After clicking finish on the New Project dialog Android Studio instantly shows an error in the bottom right corner: "Project wasn't configured" Project wasn't configure error

After that I see these errors (text is below): Android Studio build window output

'pod install' command failed with an exception:  Cannot run program "pod" (in directory "/Users/johndoe/AndroidStudioProjects/MyApplication/iosApp"): error=2, No such file or directory
        
        Possible reason: CocoaPods is not installed
        Please check that CocoaPods v1.10 or above and cocoapods-generate plugin are installed.
        
        To check CocoaPods version type 'pod --version' in the terminal
        
        To install CocoaPods execute 'sudo gem install cocoapods'
        To install cocoapod-generate execute 'sudo gem install cocoapods-generate'

The CocoaPods and cocoapod-generate are installed. When in the terminal window I can execute some commands succesfully (eg. pod --version (version 1.11.2) and pod install) Android Studio Terminal output

Just to be clear: the directory and file it complains about do exist. I can navigate to it and run a succesful pod install and pod update command.

Is this a new bug and I'm just an early adaptor or is there a misconfiguration on my Mac? On my actual project I have the same error that compiled with the previous Android Studio version without any problems. I did have other challenges (see my different unanswered question).

Bash
  • 125
  • 6
  • Kotlin team responds faster on their own issue tracker, so I suggest you [create](https://youtrack.jetbrains.com/newIssue) an issue there. Also check out [Why not upload images of code/errors when asking a question](https://meta.stackoverflow.com/a/285557/3585796) – Phil Dukhov Jan 27 '22 at 04:42
  • 1
    For future readers: we have a pretty similar issue at Kotlin issue tracker: https://youtrack.jetbrains.com/issue/KT-50984. Consider posting a comment there too if you're facing this problem. – Artyom Degtyarev Jan 27 '22 at 09:27
  • 2
    Thank you. I solved my issue by started Android Studio with sudo command from the terminal window. To comment on the two comments above: I tried to be as compleet as possible, that's why I included the screenshots. Also the error message is present in text and I posted this issue earlier than the commented issue on the Kotlin issue tracker. – Bash Jan 27 '22 at 10:53

2 Answers2

8

There is an Android Studio bug report for this, including a workaround: https://issuetracker.google.com/issues/216364005#comment7

The root cause appear to be missing executable flag on Contents/bin/printenv file.

The workaround is to add missing flag: chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv

Stefan Haustein
  • 18,427
  • 3
  • 36
  • 51
1

If the above answer doesn't work for you, try checking $SHELL value in your IDE and in the terminal that you use. In my case they were different:

Android studio used zsh, which was unable to run pod command.

I personally use bash in the terminal. And I was able to run pod from it manually.

The solution was to switch to zsh and make pod work there by installing it with sudo gem install cocoapods.