cannot inline bytecode built with jvm target 1.8 into bytecode that is being built with jvm target .

异常报错:

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

无法将用jvm目标1.8生成的字节码内联到用jvm目标1.6生成的字节码中。请指定正确的'-jvm target'选项

解决方法:

在app的gradle内 android{ }添加

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }

网上有人说如果把studio和gradle升级到新版后  新建项目 就不会遇到这种问题了

你可能感兴趣的:(kotlin,异常)