简体   繁体   中英

Adding kotlinx-datetime to my Kotlin Multiplatform app breaks iOS build

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:

  1. Create a KMM sample app with AS.
  2. Add the library : implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.3.0") to the commonMain in the build.gradle.kts
  3. Try to use/import/print LocalDate in any way

Any ideas how to solve this?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM