Hello everybody, I wanted some help on multi-plat...
# announcements
v
Hello everybody, I wanted some help on multi-platform project, on build.gradle.kts jvm target is set to 1.8 but when i run test errors keeps popping out: Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. any ideas why im getting this?
d
android?
v
no just jvm
d
Copy code
compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
what jdk do you use? if you use intellij you can press ctrl+alt+shift+s and set your level to 8 from there
v
I have this on gradle kts
Copy code
kotlin {
    jvm {
        val main by compilations.getting {
            kotlinOptions {
                jvmTarget = "1.8"
                noReflect = false
            }
        }
    }
    ....
}
d
sorry, i don't know how to use gradle kts yet
v
i tried that also setting on intellij the jvm-test to 1.8, but keeps returning to 1.6
d
v
thanks i will try to look at it
this setting never change, test is always set to 1.6, even i set it to 1.8, after running test same problem
After tinkering, and trial and error I found the solution. It seems setting on the test is a separate  on the main
Copy code
kotlin {
    jvm {
        val main by compilations.getting {
            kotlinOptions {
                jvmTarget = "1.8"
                noReflect = false
            }
        }
        // add this code below
        val test by compilations.getting {
            kotlinOptions {
                jvmTarget = "1.8"
                noReflect = false
            }
        }
    }
}
j
there is a way to set it once
checking...
Copy code
kotlin {
    jvm() {
        compilations.all {
            compileKotlinTask.kotlinOptions {
                jvmTarget = "1.8"
            }
        }
    }
I did this with android() instead of jvm() but I think it should still work
v
Right, i tried what you said and it works. Thanks
👍 1