Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6

后端 未结 30 1142
走了就别回头了
走了就别回头了 2020-11-29 14:36

When trying to run the Example CorDapp (GitHub CorDapp) via IntelliJ, I receive the following error:

Cannot inline bytecode built with JVM target 1.8 int

30条回答
  •  孤独总比滥情好
    2020-11-29 15:30

    If you have many sourcesets/modules it can be cumbersome to configure the jvmTarget for each of them separately.

    You can configure the jvmTarget for all of them at once like so:

    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
    

    This snippet can be used on top level of your gradle.build file

    After modifying the gradle file Reimport All Gradle Imports. To check if it worked, open Project Structure and verify that IntelliJ correctly assigned JVM 1.8 to all Kotlin-Modules. It should look like this:

    I would not recommend changing the platform directly in IntelliJ, because anyone else cloning your project for the first time is likely to face the same issue. Configuring it correctly in gradle has the advantage that IntelliJ is going to behave correctly for them right from the start.

提交回复
热议问题