我是 KMM 的新手,刚刚在 Macbook M1 Pro 上创建了一个新的 KMM 应用程序项目。没有代码更改,这只是我正在使用的 hello world 应用程序。我已经能够成功构建 Android 平台的项目,并且它在 Android 模拟器上运行良好。但是,当我尝试为 ios 平台构建它时,它失败并显示以下错误消息:
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.
目前,KMM 插件创建的基础应用程序已注释掉对 ARM 模拟器的支持,因为有些库尚不支持它。这很可能是由 Ktor 造成的,它最近才添加了支持。
转到
shared/build.gradle.kts
并取消注释所有包含 iosSimulatorArm64
的行。