将Kotlinx-Datetime添加到我的Kotlin Multiplatform应用程序中断iOS构建
我能够成功运行Android Studio在Android和iOS中生成的示例应用程序。在向导步骤中,我选择了Cocoapods。
但是,当我添加 kotlinx-datetime 到我的依赖项,我只能为Android运行该应用程序。
我的build.gradle.kts:
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.0")
}
}
...
添加库时,我会收到以下错误:
> Task :shared:linkDebugFrameworkIosX64 FAILED
e: Compilation failed: Expecting descriptor for kotlin.time/TimeMark.<init>|-5645683436151566731[0]
* Source files:
* Compiler version info: Konan: 1.7.0 / Kotlin: 1.7.20
* Output kind: STATIC_CACHE
e: java.lang.IllegalStateException: Expecting descriptor for kotlin.time/TimeMark.<init>|-5645683436151566731[0]
如何复制:
- 使用AS创建KMM示例应用程序。
- 添加库:实现(“ org.jetbrains.kotlinx:kotlinx-datetime:0.3.0”) to build.gradle.kts中的commanmain
- 尝试以任何方式使用/import/import/import/import localdate
有什么想法解决这个问题吗?
I was able to successfully run the sample app generated by Android Studio in both Android and iOS. I chose CocoaPods during the Wizard steps.
But when I add kotlinx-datetime to my dependencies, I can only run the app for Android.
My build.gradle.kts :
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.0")
}
}
...
When adding the library I get the following error:
> Task :shared:linkDebugFrameworkIosX64 FAILED
e: Compilation failed: Expecting descriptor for kotlin.time/TimeMark.<init>|-5645683436151566731[0]
* Source files:
* Compiler version info: Konan: 1.7.0 / Kotlin: 1.7.20
* Output kind: STATIC_CACHE
e: java.lang.IllegalStateException: Expecting descriptor for kotlin.time/TimeMark.<init>|-5645683436151566731[0]
How to reproduce:
- Create a KMM sample app with AS.
- Add the library : implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.0") to the commonMain in the build.gradle.kts
- Try to use/import/print LocalDate in any way
Any ideas how to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
升级到Kotlin 1.7.0并使用Kotlinx-Datetime 0.3.2之后,我开始遇到同一问题。
如建议的在这里,升级到
org.jetbrains.kotlinx:kotlinx-dateTime:kotlinx-dateTime:kotlinx-datetime: 0.3.3
解决了问题。After upgrading to Kotlin 1.7.0 and using kotlinx-datetime 0.3.2, I started to face the same issue.
As suggested here, upgrading to
org.jetbrains.kotlinx:kotlinx-datetime:0.3.3
solved the issue.