react-native: Task 'installDebug' not found in project ':app'. Some candidates are: 'installDevDebug', 'installQaDebug', 'installUaDebug'.

React Native version:

System:
    OS: macOS High Sierra 10.13.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 195.18 MB / 16.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 11.10.1 - /usr/local/bin/node
    Yarn: 1.10.1 - /usr/local/bin/yarn
    npm: 6.7.0 - /usr/local/bin/npm
    Watchman: 4.7.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 23.0.1, 26.0.2, 27.0.3, 28.0.3
      System Images: android-28 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.5429.30.34.5452501
    Xcode: 10.1/10B61 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6
    react-native: 0.60.4 => 0.60.4
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

Steps To Reproduce

  1. git clone from repo: https://github.com/ldco2016/NFIBEngage
  2. npm install
  3. react-native run-android

Describe what you expected to happen:

For the android version of the app to continue to build as before when running react-native run-android

Snack, code example, screenshot, or link to a repository:

https://github.com/ldco2016/NFIBEngage

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 49 (4 by maintainers)

Most upvoted comments

Ahh, so is there a flag I need to add so that it runs installDevDebug or one of the other flavors?

By the way I just did a ./gradlew installDevDebug and that built successfully.

Ha! I just ran react-native run-android --variant=DevDebug and it also built successfully!

@dulmandakh , thank you for walking me through this. You shed light on some details I was not aware of.

Hey there!

I have solved this problem You just need to make 1 file in Android Folder so

Go android folder

Make file local.properties

then just add this code in local.properties file:-

If MacBook then sdk.dir=/Users/username/Library/android/sdk

if Windows then sdk.dir=C:\Users\UserName\AppData\Local\Android\sdk

if Linux then sdk.dir = /home/USERNAME/Android/sdk

if you want to know what is your system USERNAME then just use command for Mac whoami

and then just rerun command react-native run-android

Thanks šŸ˜ƒ

Running ./gradlew tasks before running react-native run-android again seemed to do the trick for me, for some reason.

Hi guys. Iā€™m getting the same issue. When I run ā€œ./gradlew tasksā€ I get a "./gradlew no such file or directory error. Can you please provide more detail on how you run this?

Hi @mgoral2. I opened the android folder in AndroidStudio and to run the project. After that, you can use the react-native CLI without this errors.

I cloned the repo, and it builds just fine. It looks like you defined variants in build.gradle. Please check your config.

i had the same issue in fresh react-native project (react-native init projectname) after running react-native start then react-native run-android in VS code. It is in RN "0.62.1"

Solution:- i open Android Studio, then clean and rebuild.

I am not sure would it work after clean and rebuild.

i also did and gave the sdk path in root project

export ANDROID_HOME=/home/mycomputer/Android/Sdk/
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Then it works.

My npm version 6.7.0 My Node version v11.10.1 react-native-cli: 2.0.1 react-native: 0.62.1

Running ./gradlew tasks before running react-native run-android again seemed to do the trick for me, for some reason.

Thanks @SkariDamm my project is running

I tried this:

  1. Open android studio
  2. Choose open an existing android studio project
  3. Then open your project -> android folder
  4. Click the AVD Manager on the top right screen Screen Shot 2020-04-24 at 10 45 10
  5. Launch your virtual device
  6. Run npx react-native run-android

do ensure there exists a local.properties file in yout android foler ( MAC nd LINUX users only ) which contains the information regarding ur sdk location sdk.dir = /home/shubham/Android/Sdk

Worked for me on Windows:

Using / instead of \ on sdk.dir.

android/local.properties sdk.dir=D:/Android/Sdk

I used npx react-native init name-project, but it still got error. Steps below worked for me.

Open Android Studio / Build / Make Project 
Run `npx react-native run-android` again

Hi guys. Iā€™m getting the same issue. When I run ā€œ./gradlew tasksā€ I get a "./gradlew no such file or directory error. Can you please provide more detail on how you run this?

You might need to navigate to the android folder within your project.

I fixed mine by running this command below.

react-native run-android --variant PRODUCTFLAVORDebug --appIdSuffix PRODUCTFLAVOR

npx react-native doctor spot the issues and fix them

Well, to be clear I am not running installDebug, I just run react-native run-android same as you did when that error appears. Is there a flag I should be adding to react-native run-android command?

for me create file local.properties in /android/ folder with sdk.dir=/Users/yes.skyscrapers/Library/Android/sdk path to ur sdk

I did everything from beginning from this tutorial and it works now: https://reactnative.dev/docs/environment-setup

Earlier I was setting up with some YT tutorial which doesnā€™t mention some steps

export ANDROID_SDK_ROOT=~/Android/Sdk Solved the problem for me on Linux. Try replacing with your Android SDK path.

I was facing the same issue. Adding ANDROID_HOME environment variable and adding platform-tools directory to PATH fixed the installDebug related issue for me. You also might need to set JAVA_HOME environment variable pointing to the JDK installation directory