skip to Main Content

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:

enter image description here

The above error used to happen when the device have disconnected.

I saw the enviroment variables and it’s aparently okay:

enter image description here

But when I run npx react-native doctor, it shows that android sdk, jdk and android studio are not configured:

enter image description here

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


  1. Chosen as BEST ANSWER

    I've solved the problem! I've deleted node_modules folder and run npm 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.


  2. I had this same issue. Mine was even showing that:

        Android
     ✓ JDK
     ✖ Android Studio - Required for building and installing your app on Android
     ✖ Android SDK - Required for building and installing your app on Android   
       - Versions found: N/A
       - Version supported: 29.0.3
     ✓ ANDROID_HOME
    
    Errors:   2
    Warnings: 0 
    Usage
     › Press f to try to fix issues.
     › Press e to try to fix errors.
     › Press w to try to fix warnings.
     › Press Enter to exit.
    

    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:

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