Hello! I have a KMP project in Android studio. At ...
# multiplatform
j
Hello! I have a KMP project in Android studio. At this point in time, I only have an android target. So I have a simple app module and a common kmp module. The app compiles, but highlighting and autocompletion is totally broken. Is there a known issue with android studio and KMP? Using kotlin 1.7.0, latest android studio chipmunk 2021.2.1 Patch 1
I for example added a kmp module using the kmp plugin, the test code compiles but the
Copy code
actual class Platform actual constructor() {
    actual val platform: String = "Android ${android.os.Build.VERSION.SDK_INT}"
}
code is highlighted in red saying
Actual constructor of 'Platform' has no corresponding expected declaration
gradle of the kmp module is:
Copy code
plugins {
    kotlin("multiplatform")
    id("com.android.library")
}

version = "1.0"

kotlin {
    android()

    sourceSets {
        val commonMain by getting
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val androidMain by getting
        val androidTest by getting
    }
}

android {
    compileSdk = 32
    sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
    defaultConfig {
        minSdk = 21
        targetSdk = 32
    }
}
gradle.properties:
Copy code
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.mpp.enableCInteropCommonization=true
kotlin.native.enableDependencyPropagation=false
kotlin.native.ignoreDisabledTargets=true
m
Sounds like it might be caused by https://issuetracker.google.com/issues/231701341 I downgraded to Bumble Bee due to poor KMM support in Chipmunk.
👍 1
j
I solved it by adding an empty js config 😕
@mkrussel thanks for the hint! apparently it is related to only having 1 jvm target
so adding a fake js target works 😄
(I guess adding an iOs or native target would do the trick as well)