https://kotlinlang.org logo
Title
f

Frank

07/12/2021, 8:43 AM
I’ve installed the plugin but I cannot use the @Preview-Annotation nor do I see the preview icon:
1
a

Alexander Kurasov[JB]

07/12/2021, 8:44 AM
You need:
import androidx.compose.desktop.ui.tooling.preview.Preview
after that you can use @Preview and icon will appear
f

Frank

07/12/2021, 9:11 AM
I guess my project setup is wrong.
a

Alexander Kurasov[JB]

07/12/2021, 9:41 AM
What’s the issue?
f

Frank

07/12/2021, 9:44 AM
Sorry, my internet disconnected. When I do this import it says it cannot find the import:
import androidx.compose.desktop.ui.tooling.preview.Preview
1
I’ve just created a plain project using IntelliJ. There is no gradlew - file either in the project directory. In a previous project it was there.
a

Alexander Kurasov[JB]

07/12/2021, 9:53 AM
Without Gradle it will be pain… Can you create a project using Kotlin wizard?
You miss UI tooling library. Add to your dependencies { .... implementation(compose.uiTooling) }
it is in build.gradle.kts file
f

Frank

07/12/2021, 10:05 AM
I’ve created it a second time using the wizard for Compose Desktop Apps in INtelliJ. Now gradlew is there. But the import is not working:
I’m pretty new to gradle. Only used maven so far.
implementation(compose.uiTooling) doesn’t work: nt/build.gradle.kts:21:28: Unresolved reference: uiTooling
a

Alexander Kurasov[JB]

07/12/2021, 10:18 AM
Could you share content of your build.gradle file here?
f

Frank

07/12/2021, 10:18 AM
Here it is:
a

Alexander Kurasov[JB]

07/12/2021, 10:20 AM
change id(“org.jetbrains.compose”) version “0.4.0" to id(“org.jetbrains.compose”) version “0.5.0-build235" and refresh gradle (after you edit the file, the grey icons will appear to the left. press both - they will reload libraties)
👍 1
Preview was done only in buil235
f

Frank

07/12/2021, 10:24 AM
Thank you so much. It works now.
🥳 2