Another day - another gradle\kotlin tooling glitch
Kotlin MPP project - common, js, jvm and (new) android traget. androidMain is not added as proper source root in most recent Idea 2023.3.3, it does not have implicit dependency on commonMain. Again it is impossible to figure out what needs to be done to setup this type of project. Kotlin documentation does not have enough of details. Can anybody help please?
Example project is attached.
GradleMultiplatformWithAndroidTarget.zip (5.6 KB)
plugins {
id 'org.jetbrains.kotlin.multiplatform'
id 'com.android.library'
id 'maven-publish'
}
android {
compileSdk 34
namespace = "com.gradle_glitches"
defaultConfig {
//applicationId = "com.gradle_glitches"
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.0"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlin {
jvmToolchain(8)
}
}
kotlin {
def ENV = System.getenv()
def ANDROID_HOME = ENV['ANDROID_HOME']
androidTarget("main") {
}
sourceSets {
androidMain {
dependencies {
//compileOnly files("C:/tools/android-sdk/platforms/android-34/android.jar")
compileOnly files("$ANDROID_HOME/platforms/android-${android.compileSdk}/android.jar")
}
}
}
}