skip to Main Content

I cloned a React Native project and I try to run the command
yarn run android or adb reverse tcp:8081 tcp:8081 & set NODE_ENV=development & react-native run-android --list-devices --verbose

But I keep getting the following error

error Failed to build the app.
Error: Command failed with exit code 1: gradlew.bat app:installDebug -x lint -PreactNativeDevServerPort=8081
    at makeError (C:UsersHUAWEIWebstormProjectsMartinesapplicationclientnode_modulesexecaliberror.js:60:11)
    at module.exports.sync (C:UsersHUAWEIWebstormProjectsMartinesapplicationclientnode_modulesexecaindex.js:194:17)
    at build (C:UsersHUAWEIWebstormProjectsMartinesapplicationclientnode_modules@react-native-communitycli-platform-androidbuildcommandsbuildAndroidindex.js:68:22)
    at runOnSpecificDevice (C:UsersHUAWEIWebstormProjectsMartinesapplicationclientnode_modules@react-native-communitycli-platform-androidbuildcommandsrunAndroidindex.js:221:33)
    at buildAndRun (C:UsersHUAWEIWebstormProjectsMartinesapplicationclientnode_modules@react-native-communitycli-platform-androidbuildcommandsrunAndroidindex.js:164:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Command.handleAction (C:UsersHUAWEIWebstormProjectsMartinesapplicationclientnode_modules@react-native-communityclibuildindex.js:118:9)
error Command failed with exit code 1.

My computer’s OS is Windows 11, I’ve installed java SDK 22, added the env and path variables for both Java and Android.

I have no idea on what to do next. I already tryed that solution text

But I already have a settings file, that seems fine to me:

rootProject.name = 'LesMartines'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

Thanks in advance !

2

Answers


  1. Chosen as BEST ANSWER

    I found the solutions ! First, thanks to the answer of Kirill, I changed the JDK to from 22 to 17, Then, in android studio -> settings -> sdk -> sdk tools, I installed Android SDK command-line tools enter image description here

    Finally, I removed the ligne org.gradle.java.home from android roots project.


  2. The current version of React Native supports JDK version 17.

    choco install -y nodejs-lts microsoft-openjdk17
    

    Detailed instruction are here https://reactnative.dev/docs/0.73/environment-setup?os=windows

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search