Hi! How to do this ``` jvm { compilatio...
# multiplatform
d
Hi! How to do this
Copy code
jvm {
        compilations.main.kotlinOptions { 
            jvmTarget = "1.8"
        }
    }
for android? it works for jvm, but on android target I get:
Copy code
Could not get unknown property 'main' for KotlinJvmAndroidCompilation container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer.
during gradle sync
k
Copy code
tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
}
👍 1
d
Sigh. I hoped this is more in line with how it's done on jvm. Why such assymmetry?...
k
i also do it this way with JVM
d
got it. will try this way, we have it like this on non-kmp android, but I thought here it's a bit different, because this is what recommended in official docs (for jvm, nothing for android).
k
they do the same thing. the snippet I pasted handles all KotlinCompile tasks, the one you pasted handles just one
android.compilations["main"].kotlinOptions.jvmTarget = "1.8"
or something similar would probably also work
d
that's exactly what I've thought too and what I've tried. See my top post, this gives me an exception 🙂
that's what has surprised me. it's not the same for android compilation for some reason
k
what I've written and what you've written are different
you have compilations.main, I have compilations["main"]
d
hmmm. Somehow I thought that this translates to the same thing. Thanks, I'll try this one a bit later!
k
the first one requires an extension function