compose-multiplatform
compose-multiplatform copied to clipboard
IDEA preview plugin doesn't work for compose multiplatform application
when run task: desktop:configureDesktopPreviewJvm or common:configureDesktopPreviewDesktop, error occurs
Some problems were found with the configuration of task ':desktop:configureDesktopPreviewJvm' (type 'AbstractConfigureDesktopPreviewTask').
- In plugin 'org.jetbrains.compose.ComposeCompilerKotlinSupportPlugin' type 'org.jetbrains.compose.desktop.preview.tasks.AbstractConfigureDesktopPreviewTask' property 'idePort$compose' doesn't have a configured value.
Hello! Which IDEA and which plugin version do you use?
Hello! Which IDEA and which plugin version do you use?
IDEA 2021.2.3(Ultimate Edition) Build #IU-212.5457.46 Compose Multiplatform IDEA Support : 1.0.0-rc10
It works only in "Compose Desktop" project.
after update to 1.0.0 , still not work. @Preview annotation cann't be resolved
Some problems were found with the configuration of task ':desktop:configureDesktopPreviewJvm' (type 'AbstractConfigureDesktopPreviewTask').
@iptton do you run the task manually? It should be run only from Intellij plugin.
@Preview annotation cann't be resolved
Do you have a dependency on compose.desktop.currentOs?
Please note, that the preview annotation and functionality is not available in common code yet.
Here is the example of MPP project configuration https://github.com/JetBrains/compose-jb/blob/master/idea-plugin/examples/simple-preview-example/mpp-jvm/build.gradle.kts (note that in the example the preview is available only in desktopMain source set, but unavailable in commonMain source set)
@iptton do you run the task manually? It should be run only from Intellij plugin.
yes ,because i cannot see preview, i tried to run it manually
Do you have a dependency on compose.desktop.currentOs?
I am using @preview in common module androidMain/commonMain/desktopMain folders of this project: https://github.com/JetBrains/compose-jb/tree/master/examples/todoapp
seams it has configured correctly but not work.
And i saw some error in file: desktopMain/kotlin/example..../Utils.kt
Cannot access 'java.io.Serializable' which is a supertype of 'kotlin.Int'. Check your module classpath for missing or conflicting dependencies
The project's clean, not changed any thing but add code like:
@Preview
@Composable
fun Test(){
}
@iptton I had a similar problem and I just found out that Preview was not working with Java 17. In order to get previews to work I set kotlinOptions.jvmTarget = "16" in my build.gradle.kts.
I experience a similar issue on IDEA 2022.3.3: no preview. Turns out it's just a misleading user experience for someone used compose on Android Studio.
The preview doesn't appear automatically, I need those 2 steps to get it:
- run the app once, this will add a small icon in front of composable functions
- click the small preview icon of the composable I want see
i renamed my preview functions to <>Preview() with the annotation and it worked
saved
@iptton I had a similar problem and I just found out that Preview was not working with Java 17. In order to get previews to work I set kotlinOptions.jvmTarget = "16" in my build.gradle.kts.
saved my life. I'd never thought it'd be the sdk's problem
Why is it still not fixed in 2023 with version 1.4.3?? Java 17 is so popular today :stuck_out_tongue_closed_eyes:
Same issue with compose version 1.4.3 and Java 17 ...
issue still here
yeah still not working
i tried with fleet IDE and it should work https://www.jetbrains.com/fleet/
@ThuanPx No,Fleet can't preview... , Just follow guide , I can't preview any desktop preview ~ Fleet -1.35.115
@ThuanPx No,Fleet can't preview... , Just follow guide , I can't preview any desktop preview ~ Fleet -1.35.115
are you using jdk 11 or 17?
@ThuanPx No,Fleet can't preview... , Just follow guide , I can't preview any desktop preview ~ Fleet -1.35.115
are you using jdk 11 or 17?
I am using openjdk 17 ~
@ThuanPx No,Fleet can't preview... , Just follow guide , I can't preview any desktop preview ~ Fleet -1.35.115
are you using jdk 11 or 17?
I am using openjdk 17 ~
try using jdk 11
