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

    private val viewModel: MyViewModel by viewModels()

复制代码

编译提示错误,如下:

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' optio

解决方法,在 gradle 里面添加:

android {
kotlinOptions {
        // work-runtime-ktx 2.1.0 and above now requires Java 8
        jvmTarget = "1.8"
    }
}
复制代码
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享