React Native Build Failed when running react-native app

222 Views Asked by At

Whenever running npx react-native run-android, getting following error:

system configuration:

Windows 11 JDK: 11 AMD processor react-native latest version


**FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\hp\xyz\project-dev-1\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 450

* What went wrong:
A problem occurred evaluating script.
> Calling `[node, C:\Users\hp\xyz\project-dev-1\node_modules\@react-native-community\cli\build\bin.js, config]` finished with an exception. Error message: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object
  
  The current character read is 'i' with an int value of 105
  Unable to determine the current character, it is not a string, number, array, or object
  line number 1
  index number 0
  info Run CLI with --verbose flag for more details.
  ^. Output: info Run CLI with --verbose flag for more details.

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

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.

* Where:
Script 'C:\Users\hp\xyz\project-dev-1\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 450

* What went wrong:
A problem occurred evaluating script.
> Calling `[node, C:\Users\hp\xyz\project-dev-1\node_modules\@react-native-community\cli\build\bin.js, config]` finished with an exception. Error message: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

  The current character read is 'i' with an int value of 105
  Unable to determine the current character, it is not a string, number, array, or object
  line number 1
  index number 0
  info Run CLI with --verbose flag for more details.
  ^. Output: info Run CLI with --verbose flag for more details.

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

    at makeError (C:\Users\hp\xyz\project-dev-1\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
    at C:\Users\hp\xyz\project-dev-1\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runOnAllDevices (C:\Users\hp\xyz\project-dev-1\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (C:\Users\hp\xyz\project-dev-1\node_modules\@react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.**

followed all the instructions from react-native official website for Windows and Android.

Also tried ./gradlew clean for clean-up and ./gradlew assembleDebug for rebuilding the project, which did not work. Any help is greatly appreciated.

was expecting android studio to build successfully and open my react-native app on the android emulator

0

There are 0 best solutions below