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

后端 未结 30 1029
走了就别回头了
走了就别回头了 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:25

    If using Visual Studio Code** with Kotlin extension, go to the plugin management Crtl + Shift + x, type kotlin and click on manage (the little gear) >> Configure Extension Settings

    on Kotlin >> Compiler >> Jvm:Target - type the java version. In my situation just typed 1.8

    And then restart :-)

    ** vscode or just 'code' for linux

    0 讨论(0)
  • 2020-11-29 15:25

    If you use Eclipse assuming you downloaded the Kotlin plugin:

    Right click project -> Properties -> Kotlin Compiler -> Enable project specific settings -> JVM target version "1.8"

    0 讨论(0)
  • 2020-11-29 15:27

    Feb 2020
    android 3.4+
    Go to File -> Settings -> Kotlin Compiler -> Target JVM Version > set to 1.8 and then make sure to do File -> Sync project with Gradle files

    Or add this into build.gradle(module:app) in android block:

    kotlinOptions {
               jvmTarget = "1.8"
             }
    
    0 讨论(0)
  • 2020-11-29 15:27

    In my case, jvmTarget was already set in build.gradle file as below.

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

    But my issue was still there. Finally, it gets resolved after Changing Target JVM version from 1.6 to 1.8 in Preferences > Other Settings > Kotlin Compiler > Target JVM version. see attached picture,

    0 讨论(0)
  • 2020-11-29 15:29

    you should configure something like as follows in build.gradle

    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
    
    0 讨论(0)
  • 2020-11-29 15:30

    In my case, just changingTarget JVM Version like this: File > Setting > Kotlin Compiler > Target JVM Version > 1.8 did not help. However, it does resolved compile time error. But failed at runtime.

    I also had to add following in app build.gradle file to make it work.

     android {
         // Other code here...
         kotlinOptions {
            jvmTarget = "1.8"
         }
     }
    
    0 讨论(0)
提交回复
热议问题