React-native: Task 'installDebug' not found in project ':app'. Some candidates are: 'installDevDebug'.

Created on 6 May 2019  路  19Comments  路  Source: facebook/react-native

I am developing an android application and whenever I run 'yarn android' command, I am getting the error as shown below,

FAILURE: Build failed with an exception.

  • What went wrong:
    Task 'installDebug' not found in project ':app'. Some candidates are: 'installDevDebug'.

I am expecting that the app must be installed in real device by using 'yarn android' command

React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
Memory: 122.39 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.13.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 18, 21, 22, 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.2, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.0
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.5429.30.34.5452501
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.59.5 => 0.59.5
npmGlobalPackages:
react-native-cli: 2.0.1

Bug

Most helpful comment

Hey there!

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

Go inside the android folder

Create 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 :)

All 19 comments

perhaps you defined a flavor in build.gradle, please try to remove it. If you want to use flavor, usually it's recommended to have them in production builds. Please let me know if this fixed your issue.

Did this fix the issue, I am getting the same problem with a React Native 0.59.9

@denizbas92 , what version of Gradle are you running? I was able to resolve this issue, but I am not sure if it would work for you. Let me know what version of Gradle you are on.

My version is classpath 'com.android.tools.build:gradle:3.3.2'.. This isssue is still exist

cd android
./gradlew build

I removed flovars and the issue is solved @dulmandakh

@denizbas92 if so please close this issue.

@dulmandakh can you explain how to use productFlavors in a way that does not cause this error?

I'm using like this:

react-native run-android --appIdSuffix dev --variant devDebug

where dev is one of the productFlavors

Hey there!

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

Go inside the android folder

Create 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 :)

@UsmanRana77 the Windows one should be kinda like this
sdk.dir=C\:\\Users\\[USERNAME]\\AppData\\Local\\Android\\Sdk

or you can open android folder from your project directory with Android Studio and it will automatically generate that file

I am new and would like to learn I had exactly the same problem I don't quite understand the following three lines
"Go android folder

Make file local.properties

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

help please

I am new and would like to learn I had exactly the same problem I don't quite understand the following three lines
"Go android folder

Make file local.properties

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

help please

Hey @Luniq

1) Open your brand new React Native project

2) Go inside Android folder

3) Create a file:- local.properties

4)Once you create local.properties file open the file

5)Paste code inside your local.properties file

If you are using MacBook then paste this code:-

sdk.dir=/Users/USERNAME/Library/android/sdk

if you are using Windows then paste this code:-

sdk.dir=C:\\Users\\USERNAME\\AppData\\Local\\Android\\sdk

if you are using Linux then paste this code:-

sdk.dir = /home/USERNAME/Android/sdk

6)last thing just run command npx react-native run-android

@UsmanRana77 super Thank you !

It's work. Thx @UsmanRana77!

sdk.dir=/Users/username/Library/android/sdk

this worked! THANKS!

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

@UsmanRana77 Worked. Thank you so much.

It worked. Thanks@UsmanRana77!

Was this page helpful?
0 / 5 - 0 ratings