Skip to content
Advertisement

Does react-native support jdk 17?

So I have been having some problems with launching the initial react-native template project on android. And after consulting someone I was told that jdk 17 is not supported. But I really don’t want to downgrade as this could break other things that I already have and work with. To be specific this is the error I get:

> 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:UserskartiDesktopShoppingListnode_modulesexecaindex.js:174:9)
    at C:UserskartiDesktopShoppingListnode_modulesexecaindex.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (C:UserskartiDesktopShoppingListnode_modules@react-native-communitycli-platform-androidbuildcommandsrunAndroid    at async Command.handleAction (C:UserskartiDesktopShoppingListnode_modules@react-native-communityclibuildindex.js:192:9)

I have looked at this already and nothing worked. Gradle: Execution failed for task ‘:processDebugManifest’

Advertisement

Answer

So I solved this issue by installing JDK 16 on my system and everything is solved and running fine. I don’t know if the problem was with Gradle or JDK or react-native but hope that in the future jdk 17 is supported.

If you have the same issue then you can go to: jdk 16

1)Download and Install the JDK 16.

2)Add the path to your jdk in the PATH in your system environment variable.

3)Open cmd and do java -version you should see something like

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)
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement