Reputation: 57
I try to install react native and Build failed. Why?
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\stefa\Desktop\REACT\better> npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disae it using "--no-jetifier" flag. Jetifier found 863 file(s) to forward-jetify. Using 12 workers... info Starting JS server... info Installing the app...
Task :app:processDebugMainManifest FAILED 11 actionable tasks: 11 executed
FAILURE: Build failed with an exception.
Unable to make field private final java.lang.String java.io.File.ph accessible: module java.base does not "opens java.io" to unnamed mule @49c3ac54
Try: Run with --stacktrace option to get the stack trace. Run with --infor --debug option to get more log output. Run with --scan to get fullnsights.
Get more help at https://help.gradle.org
BUILD FAILED in 8s
error Failed to install the app. Make sure you have the Android devepment environment set up: https://reactnative.dev/docs/environment-sup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevrverPort=8081
FAILURE: Build failed with an exception.
Unable to make field private final java.lang.String java.io.File.ph accessible: module java.base does not "opens java.io" to unnamed mule @49c3ac54 get more log output. Run with --scan to get full insights.
BUILD FAILED in 8s
at makeError (C:\Users\stefa\Desktop\REACT\better\node_modules\execa\index.js:174:9)
at C:\Users\stefa\Desktop\REACT\better\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\stefa\Desktop\REACT\better\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\stefa\Desktop\REACT\better\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details. PS C:\Users\stefa\Desktop\REACT\better>
Upvotes: 2
Views: 14484
Reputation: 411
This is most probably due to the JDK being lower than JDK11. Try Installing JDK11 by opening your project in Android Studio and then following these steps:
Gradle JDK:
under Gradle projects.Upvotes: 1