Michael Paus
01/24/2022, 11:08 AMdarkmoon_uk
01/24/2022, 11:51 AMplugins {
id("com.android.library")
kotlin("multiplatform")
id("org.jetbrains.compose")
}
android {
...
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerVersion = Versions.Kotlin // Removing this broke my compilation, despite it being @Deprecated YMMV
kotlinCompilerExtensionVersion = Versions.Compose.GoogleAndroid
}
}
commonMain
source set:
kotlin {
...
sourceSets {
val commonMain by getting {
dependencies {
...
implementation(compose.runtime)
implementation(compose.material)
implementation(compose.materialIconsExtended) // Optional
implementation(compose.foundation)
implementation(compose.preview)
implementation(compose.uiTooling)
}
}
}
}
Michael Paus
01/24/2022, 1:54 PMPlugin [id: 'org.jetbrains.compose'] was not found in any of the following sources:
And where did you define Versions.Kotlin and Versions.Compose.GoogleAndroid?Guilherme Cordeiro
01/24/2022, 4:34 PMid("org.jetbrains.compose")
on the build.gradle you imported the compose dependencies, without a specific version?
Usually this plugin requires an explicit version parameter, like: id("org.jetbrains.compose") version "1.0.1"
but you can omit it by declaring a resolution strategy on `settings.gradle.kts`:
pluginManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
maven("<https://maven.pkg.jetbrains.space/public/p/compose/dev>") // <- is is required in all modules that use compose plugin too
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == "org.jetbrains.compose") {
useModule("org.jetbrains.compose:compose-gradle-plugin:1.0.1")
}
}
}
}
This way you keep the version on all modules in syncMichael Paus
01/24/2022, 5:03 PM"org.jetbrains.compose"
I also left out the block
composeOptions {
kotlinCompilerVersion = Versions.Kotlin // Removing this broke my compilation, despite it being @Deprecated YMMV
kotlinCompilerExtensionVersion = Versions.Compose.GoogleAndroid
}
and tried with the defaults and I am also wondering why Chris is using the plugin id("com.android.library")
whereas IntelliJ generated a template with id("com.android.application")
.