skip to Main Content

i install android studio , node js, JDK 17 with the config of this video : https://www.youtube.com/watch?v=G0wrlZvDjrE

But when i run the app with the cmd : npx react-native start.
I have this error message.

:ReactNative:Running '[node, -e, try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}]' command failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:UsersvalenDocumentsGitHubSuperAppnode_modules@react-native-communitycli-platform-androidnative_modules.gradle' line: 397

* What went wrong:
A problem occurred evaluating script.
> Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@2520ef93] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

* 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.

Someone can help me to fix this ?

Thank you,

If i run : npx react-native run-android, i have a error message little différente.

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 

:ReactNative:Running '[node, -e, try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}]' command failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:UsersvalenDocumentsGitHubSuperAppnode_modules@react-native-communitycli-platform-androidnative_modules.gradle' line: 397

* What went wrong:
A problem occurred evaluating script.
> Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@5d05d47e] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

* 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 1s
error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
:ReactNative:Running '[node, -e, try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}]' command failed. FAILURE: Build failed with an exception. * Where: Script 'C:UsersvalenDocumentsGitHubSuperAppnode_modules@react-native-communitycli-platform-androidnative_modules.gradle' line: 397 * What went wrong: A problem occurred evaluating script. > Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@5d05d47e] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated. * 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 1s.
info Run CLI with --verbose flag for more details.

The phone run but i don’t have the app.

I only change the url of C:UsersvalenDocumentsGitHubSuperAppandroidgradlewrappergradle-wrapper because the version of gradle don’t match with JDK 17. then i put gradle 7.3.

If i run npx react-native doctor, i have a error ==>  ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A

But if i fix this and i restart the pc, the probleme stay :/

2

Answers


  1. Chosen as BEST ANSWER

    I have all of feature you say. But i fininaly find the solution. I don't know why, but with the gradle 8.5 with JDK 17 it's ok.

    Thank you,

    Valentin


  2. Go to Android Studio > Settings > Languages & Frameworks > Android SDK and check first if:

    • On SDK Platforms you do have any SDK installed
    • On SDK Tools you have: Android SDK Build-Tools, Android SDK Command-line Tools, Android Emulator, and Android SDK Platform Tools activated

    Another good thing you can do is to open your project on Android Studio and see if there are any additional errors about gradle, updates, or anything you need to address before running your project on an emulator

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