This happened while I was working with Kotlin Multiplatform and thanks to @aga for the answer, the implementation is a quite different but concept remains the same
In you build.gradle.kts go to the bottom end of the file and define the dependencies
and add this debugImplementation "androidx.compose.ui:ui-tooling"
dependencies {
debugImplementation("androidx.compose.ui:ui-tooling")
}
sync the project and Now go to android[main]
and create a Kotlin file and annotate with @androidx.compose.ui.tooling.preview.Preview
and @composable
Example
@androidx.compose.ui.tooling.preview.Preview
@Composable
fun preview() {
Yourcomposable()
}
That's all, Happy coding