JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.87k stars 1.15k forks source link

Compose-desktop @Preview fails to show preview which uses kotlin.time.Duration #2473

Open vdshb opened 1 year ago

vdshb commented 1 year ago

Desktop previewer fails to show a preview for this snippet:

import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.runtime.Composable
import kotlin.time.Duration.Companion.minutes

@Preview
@Composable
fun Reproducer(
) {
    1.minutes
}

An exception occurs:

   ...
Caused by: java.lang.NoSuchMethodError: 'long kotlin.time.DurationKt.toDuration(int, kotlin.time.DurationUnit)'
    at duration.ReproduceKt.Reproducer(Reproduce.kt:17)
   ...

kotlin version: 1.7.20 compose version: 1.3.0-alpha01-dev853

vdshb commented 1 year ago

Not an expert, but for me it looks like previewer is build on some old kotlin version like 1.5.0 or something.

okushnikov commented 1 week ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.