Android Studio KMM 应用程序项目 - 为 ios 平台构建失败

Man*_*ath 5 ios cocoapods kotlin-multiplatform

我是第一次使用 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.
Run Code Online (Sandbox Code Playgroud)

Phi*_*hov 6

目前,KMM 插件创建的基础应用程序已注释掉对 ARM 模拟器的支持,因为有些库尚不支持它。这很可能是由于 Ktor 最近才增加了支持。

转到shared/build.gradle.kts并取消注释所有包含iosSimulatorArm64.