Search code examples
ioscocoapodskotlin-multiplatform

Android Studio KMM Application project - Build for ios platform failing


I am a first time on KMM and have just created a new KMM application project on Macbook M1 Pro. No code changes, this is just the hello world app. I have been able to successfully build the project for Android platform, and it runs fine on the Android emulator. However, when I try to build it for the iOS platform, it is failing with the below error message:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':shared'.
> The project must have a target for at least one of the following platforms: ios_simulator_arm64.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 553ms
** BUILD FAILED **


The following build commands failed:
    PhaseScriptExecution [CP-User]\ Build\ shared /Users/manajit/Projects/Learning/App/KMMExperiment/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-4552119A071AC6BAB7327E6434237EC3.sh (in target 'shared' from project 'Pods')
(1 failure)
Command PhaseScriptExecution failed with a nonzero exit code.

Solution

  • Currently, the base application created by the KMM plugin has commented out support for the ARM simulator because there are some libraries that do not yet support it. This is most likely due to Ktor, which only recently added its support.

    Go to shared/build.gradle.kts and uncomment all lines containing iosSimulatorArm64.