compileKotlinIos 失败 - 找不到 stdlib

compileKotlinIos FAILED - Could not find stdlib

我正在尝试编译包含 iOS 目标的 kotlin 多平台。 我在 github 上尝试了不同的示例,但其中大部分都已过时且不起作用,可能是因为与当前工具不兼容。最合理的事情似乎是使用 IntelliJ Idea 创建 Mobile Android/iOS | GradleMobile Shared Library | Gradle 项目。

当我创建全新的项目时,我仍然遇到同样的错误:

> Task :app:compileKotlinIos FAILED
e: Could not find "stdlib" in [~/git/iosandroidtest, ~/.konan/klib, ~/.konan/kotlin-native-macos-1.3.61/klib/common, ~/.konan/kotlin-native-macos-1.3.61/klib/platform/ios_x64].

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileKotlinIos'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

我正在使用 kotlin 1.3.61,xcode 11.3。有什么想法吗?

编辑:

我将空项目(我没有做任何更改)推送到 github:

https://github.com/hovi/iostest

我认为您 运行 遇到了部分存档下载的错误。 根据那里的作者,“我得到了 .konan 目录的快照。这很有趣,因为它看起来像是运行时下载的一部分,但有些部分丢失了。特别是在这种情况下,klib 中的公共文件夹,还有许可证文件夹。

我能够通过在提取存档时终止构建过程来在本地重现此问题。有关参考,请参阅 NativeCompilerDownloader。它会查看文件夹是否存在。如果没有,它将下载并提取。如果是,则构建过程假定一切正常。 ......从那时起,他们的本地构建肯定会被破坏,直到他们清理并重建 ~.konan。”我建议你也在那里报告你的问题。(顺便说一句 - 在 IJ 和 AS 中尝试你的项目(以及创建新的库IJ 中的项目),没有任何问题。不知何故,你的运气不好,下载中断 (:)) Link to GitHub issue