I recently have started learning KMP and got stuck on this error. I have created sample project from the Jetbrains KMP wizard. I opened the downloaded project in Android Studio and installed in the emulator and it runs fine.
But when I tried to open the iOS project in XCode, I got No such module 'ComposeApp'
error on ContentView
file. Refer to the screenshot.
After spending some time in the internet, I was suggested that I need to rebuild project in Android studio then the problem will be solved.
But, when I hit rebuild/make project in Android studio, I am getting this error:
> Task :composeApp:compileIosMainKotlinMetadata FAILED
e: Compilation failed: An error occurred during an xcrun execution. Make sure that Xcode and its command line tools are properly installed.
Failed command: /usr/bin/xcrun xcodebuild -version
Try running this command in Terminal and fix the errors by making Xcode (and its command line tools) configuration correct.
* Source files: MainViewController.kt, Platform.ios.kt
* Compiler version: 2.0.0
* Output kind: LIBRARY
e: org.jetbrains.kotlin.konan.MissingXcodeException: An error occurred during an xcrun execution. Make sure that Xcode and its command line tools are properly installed.
Failed command: /usr/bin/xcrun xcodebuild -version
Try running this command in Terminal and fix the errors by making Xcode (and its command line tools) configuration correct.
I found this command to run for command line tool installation xcode-select --install
and when I run, and got
xcode-select --install
xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates
I have the latest version of macOS, Android Studio and XCode.
What could be the issue? How could this be solved?
Any help would be appreciated.