Search code examples
kotlinkotlin-multiplatform

XXXKotlinCharCompanion could not be mapped to KotlinChar.Companion


I encounter a build error when I build my project in Kotlin Mobile Multiplatform : 'XXXKotlinCharCompanion' could not be mapped to 'KotlinChar.Companion'.

I suspect it appears when I added api("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1") and export("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1") in the project to use the classes of this library on iOS.

An odd thing is that the build fails only after a clean build, a consecutive one works...

I tried kotlin 1.9.10 and 1.9.20.


Solution

  • The problem is related to transitiveExport being set to true causing a warning Xcode-side.

    I solved it by removing the transitiveExport build configuration.

    Here is a project demonstrating the issue.

    For more information regarding transitiveExport see the documentation.