0

When I try to run my react native app on the emulator I am getting this error:

> info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
> Jetifier found 863 file(s) to forward-jetify. Using 8 workers...
> info JS server already running.
> info Installing the app...
> 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 @598bc439

* 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 5s

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

FAILURE: Build failed with an exception.

* What went wrong:

* 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 5s

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

info Run CLI with --verbose flag for more details.

I want to create an app but when I run npm start and npm run android I get the above error. Is anyone aware of how to resolve this error?

Yogesh Devgun
  • 1,297
  • 1
  • 19
  • 36
Vishal Kardam
  • 24
  • 1
  • 9
  • Does this answer your question? [How to fix the ''module java.base does not "opens java.io" to unnamed module '' error in Android Studio?](https://stackoverflow.com/questions/67782975/how-to-fix-the-module-java-base-does-not-opens-java-io-to-unnamed-module) – Thanhal P A Mar 30 '22 at 14:10

1 Answers1

0

Follow the below approaches and check whether the issue is resolved or not,

Approach 1:

  1. Open the Android studio app. (If you are using an Apple machine with an M1 processor execute the command from the terminal

open -a /Applications/Android\ Studio.app
2. From the terminal of the Android Studio execute the command ./gradlew clean 3. Make sure gradle sync is successful. 4. Rebuild the project. Select the emulator and run it from Android Studio

Approach 2:

  1. Open Visual Studio Code
  2. Press Ctrl+~ This will open the terminal window. (If you are not using Visual Studio Code, Open terminal and go to the project folder)
  3. Run the following commands cd android

./gradlew clean

npx react-native run-android --variant your_variant

Hope this helps.

Guru
  • 4,693
  • 3
  • 25
  • 45