I get `Could not resolve org.jetbrains.compose.ui:...
# multiplatform
m
I get
Could not resolve org.jetbrains.compose.ui:ui-tooling:1.3.1
and
Could not resolve org.jetbrains.compose.ui:ui-tooling-preview:1.3.1
respectively when I add
implementation(compose.uiTooling)
or `implementation(compose.preview)` to
build.gradle.kts
any solution for this?
k
Where are you adding these implementations? Do you have an ios source set?
m
I’m adding it to
shared.build.gradle.kts
inside
sourceSets.commonMain.dependencies
alongside everything else compose related
and yes I have ios source set
k
If I remember correctly I think it’s an issue where since all sourcesets rely on commonMain, then the iOS sourceset will also try to get compose but will cause an issue. Try adding this to the gradle file:
Copy code
// Exclude compose from iOS. Plugins are applied to all targets i believe
plugins.removeAll { it is ComposeCompilerKotlinSupportPlugin } // Removing any Compose Plugin for all projects?
class ComposeNoNativePlugin : KotlinCompilerPluginSupportPlugin by ComposeCompilerKotlinSupportPlugin() {
    override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean {
        return when (kotlinCompilation.target.platformType) {
            KotlinPlatformType.native -> false
            else -> ComposeCompilerKotlinSupportPlugin().isApplicable(kotlinCompilation)
        }
    }
}
apply<ComposeNoNativePlugin>() // Re-adding Compose Compilers only for non-native environments
Hopefully this helps 🤞
m
interesting 😄
I’ll try
well now I’m getting No matching variant of org.jetbrains.compose.uiui tooling preview1.4.0-rc01 was found.
I can’t revert to 1.3.1 since I need HorizontalPager that was introduced in 1.4.0
but I think that what you posted above resolves the issue. when I remove your solution than I’m getting same old error
346 Views