gpt4 book ai didi

javascript - react-native 是否支持 jdk 17?

转载 作者:行者123 更新时间:2023-12-02 18:21:36 24 4
gpt4 key购买 nike

所以我在 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: Execution failed for task ':processDebugManifest'

最佳答案

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

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

1)下载并安装 JDK 16。

2)在你系统环境变量的PATH中加入你jdk的路径

3) 打开 cmd 并执行 java -version 你应该会看到类似的东西

java version "16.0.2" 2021-07-20
Java(TM) SE Runtime Environment (build 16.0.2+7-67)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)

关于javascript - react-native 是否支持 jdk 17?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70810675/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com