g

    Guilherme Delgado

    1 year ago
    Hello, I’m having this error:
    Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
    Adding support for Java 8 language features could solve this issue.
    And if I choose “fix it” the IDE adds this to my
    build.gradle.kts
    in shared module:
    android {
       ...
        compileOptions {
            sourceCompatibility = JavaVersion.VERSION_1_8
            targetCompatibility = JavaVersion.VERSION_1_8
        }
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
    Thing is,
    kotlinOptions
    throws unresolved reference. How can I fix this? Thanks 🙏 ps: don’t know if it’s related or just a coincidence, but I got this error after adding multiplatformSettings lib 🤔
    John O'Reilly

    John O'Reilly

    1 year ago
    try this
    tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
    g

    Guilherme Delgado

    1 year ago
    perfect @John O'Reilly, thanks!
    louiscad

    louiscad

    1 year ago
    What AGP version do you have?
    g

    Guilherme Delgado

    1 year ago
    Using 4.2.1
    louiscad

    louiscad

    1 year ago
    Was it only failing to resolve in the IDE or did Gradle sync or any other Gradle run also failed?
    g

    Guilherme Delgado

    1 year ago
    gradle sync was ok, but building was throwing:
    :shared:compileDebugKotlinAndroid
    Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
    one line per inline operation ^