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

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

    For recent versions of Android Studio, if changing just the Kotlin Target VM version didn't work.

    File ➞ Project Structure ➞ Modules (app): set both "Source Compatibility" and "Target Compatibility" to "1.8 (Java 8)". Press "OK" and sync project with Gradle.

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

    In my case this code did'n work until I move apply plugin: 'kotlin-android' from bottom to top.

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    
    android {
        ...
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
    
    0 讨论(0)
  • 2020-11-29 15:34

    In my case, I solved this by following these two steps

    1. Go to android studio preferences -> other settings -> kotlin compiler -> set Target JVM version = 1.8 
       if it doesn't work then go to the second option.
    
    2. In your module-level build.gradle file add 
       compileOptions {
            sourceCompatibility = 1.8
            targetCompatibility = 1.8
        }
        tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
            kotlinOptions {
                jvmTarget = "1.8"
            }
        }
    
    0 讨论(0)
  • 2020-11-29 15:34

    For Gradle with Kotlin language (*.gradle.kts files), add this:

    android {
        [...]
        kotlinOptions {
            this as KotlinJvmOptions
            jvmTarget = "1.8"
        }
    }
    
    0 讨论(0)
  • 2020-11-29 15:36

    This helped my project to build, add this to module build.gradle file:

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

    In my case File > Setting > Kotlin Compiler > Target JVM Version > 1.8

    0 讨论(0)
提交回复
热议问题