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:
macOs Monterey 12.2 iMac details
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:
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).
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