LighthouseGames / KmLogging

Kotlin multiplatform logging. High performance, composable and simple to use.
Apache License 2.0
84 stars 13 forks source link

KMP: cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 1.8 #24

Closed derlin closed 7 months ago

derlin commented 7 months ago

My project is configured to target Java 1.8. After importing the library and trying to use it in my Kotlin Common code, I get the following compilation error:

Cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option

Here is a sample of my Gradle (kts) file:

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

kotlin {
    jvm {
        compilations.all {
            kotlinOptions.jvmTarget = "1.8"
        }
      // ...
       sourceSets {
        val commonMain by getting {
            dependencies {
                api("org.lighthousegames:logging:1.4.0")
            }
        }
        val jvmMain by getting {
            dependencies {
                implementation("org.slf4j:slf4j-api:1.7.30")
                implementation("ch.qos.logback:logback-core:1.2.3")
                implementation("ch.qos.logback:logback-classic:1.2.3")
            }
        }
     // ...
    }
}

What am I missing?

ellsworthrw commented 7 months ago

I will downgrade version 1.4.1 to be compatible with Java 1.8