JavaSE-11 的运行时无效:运行时与“JavaSE-11”环境不兼容

Invalid runtime for JavaSE-11: Runtime at is not compatible with the 'JavaSE-11' environment

提问人:Gabi Mangili 提问时间:11/1/2023 更新时间:11/20/2023 访问量:77

问:

我在 React Native 中编程,直到 yesterdar 我的代码在物理设备上正常工作,但在模拟器中无法正常工作。一会儿我需要使用模拟器,我试图在模拟器中运行应用程序,但我怎么说,它并没有成立。我尝试了各种方法,最后它仍然不起作用,但又出现了另一个错误。今天我回到使用正在工作的设备,但由于更改,现在直到设备无法运行我的代码。

在 vscode 中,弹出 2 个错误:

  1. Invalid runtime for JavaSE-11: Runtime at 'C:\Users\Interfocus\AppData\Local\jdk-11.0.2' is not compatible with the 'JavaSE-11' environment.
  2. Invalid runtime for JavaSE-1.8: Runtime at 'C:\Program Files\Java\jdk-21' is not compatible with the 'JavaSE-1.8' environment.

问题中出现许多消息,如屏幕截图所示:

enter image description here

而且我不知道这是否相关,但即使代码在物理设备上工作,每当我打开 vscode 时,都会出现这个弹出窗口:

enter image description here

当我在终端中运行“expo run:android”时,会显示以下消息,但是我认为这是真正的问题,因为应用程序运行并且运行时,这是打开的屏幕(下图):

The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
This might happen in subprojects that apply the Kotlin plugins with the Gradle 'plugins { ... }' DSL if they specify explicit versions, even if the versions are equal.
Please add the Kotlin plugin to the common parent project or the root project, then remove the versions in the subprojects.

enter image description here

我只是想解决这个问题,但我不知道该怎么做。有人可以帮我吗?

java react-native visual-studio-code java-11 java-18

评论

0赞 JialeDu 11/2/2023
您是否尝试过切换环境?如何使用 JDK 的更新版本?

答: 暂无答案