Assat
Assat

Reputation: 57

I try to install react native and Build failed

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

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

Answers (1)

Abhishek Sah
Abhishek Sah

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:

  1. Open Settings and go to the Build, deployment.. option and click on the arrow to reveral Build option, click on the Build Option.

Step 1

  1. Click on the drop down list next to Gradle JDK: under Gradle projects.

Step 2

  1. Select Download JDK from the list and select Azul and JDK Version 11.

Step 3

  1. Click OK and wait for it to download and confirm the updated Java/JDK is selected and press Apply followed by OK.

Step 4

Upvotes: 1

Related Questions