So with:
val androidMain by getting {
dependencies {
api(compose.preview)
...
}
}
It’s able to resolve all the android preview types (
Preview
annotation,
PreviewParameterProvider
etc).
However Android Studio gives the following error when trying to render the preview:
The following classes could not be found:
- androidx.compose.ui.tooling.ComposeViewAdapter
This is a problem I’ve seen long ago with Jetpack Compose, and the solution was to add this:
debugImplementation("androidx.customview:customview-poolingcontainer:1.0.0")
But it doesn’t resolve the issue, I think it’s obsolete (for Jetpack Compose anyway). The only thing that did resolve it was to add this, which seems very very wrong 😅:
debugImplementation(platform("androidx.compose:compose-bom:2023.04.01"))
debugImplementation("androidx.compose.ui:ui-tooling")