Alexandra Gnimadi
09/30/2025, 12:56 PMJack Boswell
09/30/2025, 1:01 PMAlexandra Gnimadi
09/30/2025, 1:40 PMHrodrick
09/30/2025, 4:05 PMapi(compose.components.uiToolingPreview)
And this one at the root level of the build.gradle.kts file.
dependencies {
debugImplementation(compose.uiTooling)
}
I'm not sure the relation between those too dependencies, but I needed both in order to see the previews
By the way, I use the following plugins, which you should already be using if you can write and test your code, leaving them here just in case
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeHotReload)
}
Please let me know if that fixes your issues!
Note: I'm using "api" but you can use "implementation", it has nothing to do with the previews within the moduleAlexandra Gnimadi
10/02/2025, 6:36 AMplugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidKotlinMultiplatformLibrary)
alias(libs.plugins.androidLint)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.kotlinSerialization)
}
Also, I think that it's the real difference. But with this I found something to activate preview. I added this three dependencies in the androidMain of each build.gradle of my libraries and it permit me to see the preview now in the commonMain of my kmp library
androidMain {
dependencies {
// Add Android-specific dependencies here. Note that this source set depends on
// commonMain by default and will correctly pull the Android artifacts of any KMP
// dependencies declared in commonMain.
implementation(compose.uiTooling)
implementation(libs.androidx.emoji2.text)
implementation(libs.androidx.customview.poolingcontainer)
}
}Hrodrick
10/02/2025, 3:23 PMJonas Hansson
10/23/2025, 2:34 PMThe following classes could not be instantiated:
- androidx.compose.ui.tooling.ComposeViewAdapter (Open Class, Show Exception, Clear Cache)
Using androidKotlinMultiplatformLibrary in my modules
commonMain.dependencies {
implementation(compose.components.uiToolingPreview)
}
androidMain.dependencies {
implementation(compose.uiTooling)
}
Running CMP 1.10.0-alpha02
I’ve also tried adding previews in androidMain sourceSets as I’ve heard people getting that to work, but still no luck…
Anyone have a clue what else I’m missing?