执行失败的任务’:calculator:compileKonanKotlinArithmeticParserIphone’

那么我试着从kotlin本地回购中运行Calculator示例。

遵循以下步骤:

要构建并运行示例,请执行以下操作:

  1. 用Xcode打开samples / calculator / calculator.xcodeproj。

  2. 通过项目导航器打开项目的目标,转到标签“常规”。 在“身份”部分,以反向DNS格式将包ID更改为唯一字符串。 然后在“签名”部分选择团队。 看Xcode。 文档的更多信息。

  3. 现在使用Xcode在连接的iPhone上构建并运行应用程序。

但是当我尝试在Xcode中构建应用程序时,出现以下错误,并在其下面显示日志:

… …

The target is not enabled on the current host: linux . Target 'linux' of artifact 'libgit2' is not supported on the current host . The target is not enabled on the current host: linux . The target is not enabled on the current host: linux . The target is not enabled on the current host: linux . The target is not enabled on the current host: linux Target 'linux' of artifact 'libcurl' is not supported on the current host . The target is not enabled on the current host: linux . The target is not enabled on the current host: linux The target is not enabled on the current host: linux The target is not enabled on the current host: linux The target is not enabled on the current host: linux The target is not enabled on the current host: raspberrypi Target 'linux' of artifact 'sdl' is not supported on the current host Target 'raspberrypi' of artifact 'sdl' is not supported on the current host The target is not enabled on the current host: linux The target is not enabled on the current host: raspberrypi Target 'linux' of artifact 'tetris' is not supported on the current host Target 'raspberrypi' of artifact 'tetris' is not supported on the current host The target is not enabled on the current host: linux The target is not enabled on the current host: mingw Target 'linux' of artifact 'ffmpeg' is not supported on the current host Target 'mingw' of artifact 'ffmpeg' is not supported on the current host The target is not enabled on the current host: linux The target is not enabled on the current host: mingw Target 'linux' of artifact 'sdl' is not supported on the current host Target 'mingw' of artifact 'sdl' is not supported on the current host The target is not enabled on the current host: linux The target is not enabled on the current host: mingw Target 'linux' of artifact 'Player' is not supported on the current host Target 'mingw' of artifact 'Player' is not supported on the current host The target is not enabled on the current host: mingw :calculator:checkKonanCompiler :calculator:compileKonanKotlinArithmeticParserIphone FAILED FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':calculator:compileKonanKotlinArithmeticParserIphone'. Classpath of the tool is empty: konanc Probably the 'konan.home' project property contains an incorrect path. Please change it to the compiler root directory and rerun the build. Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Get more help at https://help.gradle.org BUILD FAILED in 8s 2 actionable tasks: 2 executed Command /bin/sh failed with exit code 1 

谢谢!

我碰到了一个非常相似的问题, Kotlin的人们发现了这个问题 。

  1. cdkotlin-native项目根目录
  2. 运行./gradlew dist crossDist
  3. 打开Xcode并运行该项目。

在iPhone 8 Plus上运行的计算器演示