hello, I am trying to add KMM module in an existing project in Android Studio while doing it I get t...
a
hello, I am trying to add KMM module in an existing project in Android Studio while doing it I get this error
Unresolved reference: ExperimentalKotlinGradlePluginApi
and in the generated module's
build.gradle
I had to comment out the below line. Anyone know what's the workaround here? `
Copy code
//@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class)
kotlin {
//    targetHierarchy.default()

    android {
        compilations.all {
            kotlinOptions {
                jvmTarget = "1.8"
            }
        }
    }
`
j
What version of Kotlin are you using? The
targetHierarchy.default()
API was added in Kotlin 1.8.20.
s
add this
Copy code
targetHierarchy.default{
    common {
        group("mobile"){
            withIos()
            withAndroid()
        }
    }
}
and also for val iosMain using getting instead of creating if you are using creating
a
Thanks, the issue is related to Kotlin version, I on 1.7.0
110 Views