简体   繁体   English

如何在Kotlin多平台移动项目中设置Android JVM目标兼容性

[英]How To Set Android JVM Target Compability in Kotlin Multiplatform Mobile Project

As the title of this question describes, I get a warning when building the Android app of my KMM project that hints me to set my JVM version to 11 as the following terminal output shows:正如这个问题的标题所描述的,我在构建我的 KMM 项目的 Android 应用程序时收到一条警告,提示我将我的 JVM 版本设置为 11,如以下终端 output 所示:

> Task :shared:compileDebugKotlinAndroid
'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlinAndroid' task (current target is 11) jvm target compatibility should be set to the same Java version

But how can I do that?但是我该怎么做呢? Setting it like you'd do it in a regular Android project doesn't seem to have an effect.像在常规 Android 项目中那样设置它似乎没有效果。

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { kotlinOptions.jvmTarget = "11" }

It is only advisory property, you could safely delete it.它只是建议属性,您可以安全地删除它。 minSdk is enough. minSdk就足够了。 See LibraryBaseFlavor reference deprecation message.请参阅LibraryBaseFlavor 参考弃用消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 项目完成后如何将 Kotlin 项目转换为 Kotlin Multiplatform Mobile? - How to convert Kotlin project to Kotlin Multiplatform Mobile after the project completion? Kotlin 多平台项目导入 jvm 变体 - Kotlin Multiplatform project import jvm variant 如何为 Kotlin Multiplatform 移动项目有效地保持 RAM 中的连续内存 - How to keep efficiently continuous memory in RAM for Kotlin Multiplatform mobile project 如何使用Kotlin同时定位JVM / Native和Android - How to target both JVM/Native and Android with Kotlin Kotlin 多平台移动 - 无法运行 iOS 项目 - 缺少此目标所需的一个或多个架构 - Kotlin multiplatform mobile - fail to run iOS project - missing one or more architectures required by this target 由于 android 目标,Kotlin 多平台构建失败 - Kotlin Multiplatform build failure due to android target 如何在 Android/IOS Kotlin 多平台项目中设置 protobuf - How to setup protobuf in Android/IOS Kotlin Multiplatform project 如何使用 gradle 和 Z4FBA3BC02B72EE9A687A1E5286E373CZ6 为 android 工作室设置 jvm 目标? - How do I set the jvm target for android studio using gradle and kotlin? 用于 Kotlin 多平台移动设备的 Skia - Skia for Kotlin multiplatform mobile 是否可以创建一个引用公共模块的正确目标的 kotlin 多平台项目? - Is it possible to create a kotlin multiplatform project referencing the correct target of a common module?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM