Kotlin Multiplatform Mobile 无法在 iOS 上 运行:任务 ':shared:compileKotlinIosX64' 执行失败

Kotlin Multiplatform Mobile unable to run on iOS: Execution failed for task ':shared:compileKotlinIosX64'

我在 KMM 中创建了新项目(Hello World),然后是他们的官方网站。在 android 中,它工作顺利,但是当我尝试在 XCode 中 运行 时,它给出了错误,因为 I am unable to build / run the xcode project。我已附上错误的屏幕截图和日志。不知何故 xcode 方案没有在我猜测的 KMM 平台中生成。 谁能帮我理解我错过了什么? 任何帮助将不胜感激。

Following is my dev env:

Xcode 11.4.1
Android 4.1.2
Kotling Plugin version 1.4.30 (stable)
KMM 0.2.0```


XCode Logs:

> Task :shared:compileKotlinIosX64
Downloading native dependencies (LLVM, sysroot etc). This is a one-time action performed only on the first run of the compiler.
Extracting dependency: /Users/fatin/.konan/cache/clang-llvm-apple-8.0.0-darwin-macos.tar.gz into /Users/fatin/.konan/dependencies
e: java.lang.RuntimeException: Cannot extract archive with dependency: /Users/fatin/.konan/cache/clang-llvm-apple-8.0.0-darwin-macos.tar.gz.

> Task :shared:compileKotlinIosX64 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:compileKotlinIosX64'.
> Compilation finished with errors

* 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 7s
1 actionable task: 1 executed
Command PhaseScriptExecution failed with a nonzero exit code ```
[![enter image description here][3]][3]


为此我联系了社区并最终找到了解决方案。这是我提出并解决了这个问题的link to that issue

如果其他人遇到同样的问题,那主要是因为 kotlin 文件损坏。 还请尝试根据评论在 XCode 中检查您的 cmd 行工具。

希望这对某人有所帮助。干杯。

如果即使从 Xcode 打开项目也没有立即 运行 并且显示缺少共享框架,则尝试为 iOS 平台生成共享框架使用终端。导航到项目文件夹并执行 命令:./gradlew packForXcode 现在共享框架应该有一个 xcode-frameworks 产品,你应该能够通过 Xcode.[= 构建和 运行 项目。 10=]

如果有两个库,则可能会发生这种情况,其中一个库是针对另一个库的不同版本而不是当前在项目中使用的库编译的。请检查项目配置是否正确,依赖版本是否一致