Sourabh Rawat
01/08/2022, 6:11 AMCould not determine the dependencies of task ':desktop:run'.
> Could not resolve all task dependencies for configuration ':desktop:jvmRuntimeClasspath'.
> Could not resolve project :common.
Required by:
project :desktop
> The consumer was configured to find a runtime of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'. However we cannot choose between the following variants of project :common:
- commonJvmDefault
- commonJvmRuntimeElements
- desktopDefault
- desktopRuntimeElements
gradle files posted in thread.Sourabh Rawat
01/08/2022, 6:12 AMimport org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose") version "1.0.0"
}
group = "com.github.dragneelfps"
version = "1.0"
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
sourceSets {
val jvmMain by getting {
dependencies {
implementation(project(":common"))
implementation(compose.desktop.currentOs)
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
}
}
compose.desktop {
application {
mainClass = "MainKt"
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "jvm"
packageVersion = "1.0.0"
}
}
}
Sourabh Rawat
01/08/2022, 6:12 AMimport org.jetbrains.compose.compose
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose") version "1.0.0"
id("com.android.library")
}
group = "com.github.dragneelfps"
version = "1.0"
kotlin {
android()
jvm("commonJvm")
jvm("desktop") {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
sourceSets {
val commonMain by getting {
dependencies {
api(compose.runtime)
api(compose.foundation)
api(compose.material)
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val commonJvmMain by getting {}
val androidMain by getting {
dependsOn(commonJvmMain)
dependencies {
api("androidx.appcompat:appcompat:1.2.0")
api("androidx.core:core-ktx:1.3.1")
}
}
val androidTest by getting {
dependencies {
implementation("junit:junit:4.13")
}
}
val desktopMain by getting {
dependsOn(commonJvmMain)
dependencies {
api(compose.preview)
}
}
val desktopTest by getting
}
}
android {
compileSdkVersion(31)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(24)
targetSdkVersion(31)
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
Sourabh Rawat
01/08/2022, 6:27 AMval commonJvmMain by creating {}
val androidMain by getting {
dependsOn(commonJvmMain)
dependencies {
api("androidx.appcompat:appcompat:1.2.0")
api("androidx.core:core-ktx:1.3.1")
}
}
val desktopMain by getting {
dependsOn(commonJvmMain)
dependencies {
api(compose.preview)
}
}