I was running the project daily with that working well. I don’t know what happened that now the app always fails to build with follow error:
BUILD FAILED in 7s
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 app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* Try:
> Run gradlew tasks to get a list of available tasks.
> 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 7s
at makeError (/var/www/html/vituzzo_mobile/node_modules/execa/index.js:174:9)
at /var/www/html/vituzzo_mobile/node_modules/execa/index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (/var/www/html/vituzzo_mobile/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:82:7)
at async Command.handleAction (/var/www/html/vituzzo_mobile/node_modules/@react-native-community/cli/build/index.js:111:9)
When I run adb devices
, it shows:
The above error used to happen when the device have disconnected.
I saw the enviroment variables and it’s aparently okay:
But when I run npx react-native doctor
, it shows that android sdk, jdk and android studio are not configured:
I tested the two options "e" and "f" from doctor, but neither was able to solve the problem
What can I do to solve that?
2
Answers
I've solved the problem! I've deleted
node_modules
folder and runnpm i
Then, I've opened Android studio to run the app from it. After, I've run the app from Android studio with success!
I've tried to run it from the old way from terminal
npm run android
and it has worked.I had this same issue. Mine was even showing that:
Just click on ‘e’ or ‘f’. It took its time and installed the said missing programs (note that I already installed Android studio and all the SDK instructions on react-native docs before now but for some reason, it was not being detected)
When I ran npx react-native doctor, the issue was resolved: