繁体   English   中英

react-native是否支持jdk 17?

[英]Does react-native support jdk 17?

所以我在 android 上启动初始 react-native 模板项目时遇到了一些问题。 在咨询某人后,我被告知不支持 jdk 17。 但我真的不想降级,因为这可能会破坏我已经拥有和使用的其他东西。 具体来说,这是我得到的错误:

> Task :app:processDebugMainManifest FAILED
11 actionable tasks: 2 executed, 9 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @7ec6bc9b

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. 

* Get more help at https://help.gradle.org

BUILD FAILED in 20s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081


* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @7ec6bc9b

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. 
* Get more help at https://help.gradle.org

BUILD FAILED in 20s

    at makeError (C:\Users\karti\Desktop\ShoppingList\node_modules\execa\index.js:174:9)
    at C:\Users\karti\Desktop\ShoppingList\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (C:\Users\karti\Desktop\ShoppingList\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid    at async Command.handleAction (C:\Users\karti\Desktop\ShoppingList\node_modules\@react-native-community\cli\build\index.js:192:9)

我已经看过这个了,没有任何效果。 Gradle:任务“:processDebugManifest”执行失败

要知道这是否是 java 版本相关问题,您需要检查您的 Gradle 版本。

目前只有 Gradle 版本 7.3 支持 java 17.

您可以查看gradle 兼容性矩阵进行检查。

您可以通过键入gradlew.bat -version使用命令行检查您的版本

如果您的 Gradle 是 7.3 版本,那么它与 JDK 版本无关。

所以我通过在我的系统上安装 JDK 16 解决了这个问题,一切都解决了并且运行良好。 我不知道问题是否出在 Gradle 或 JDK 或 react-native 上,但希望能解决。

如果你有同样的问题,那么你可以 go 到: jdk 16

并下载 JDK 16。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM