12

When starting android project with React-Native it is giving this error:

React-Native Command run-android unrecognized.Did you mean to run this inside a react-native project?

4
  • Did u initialize a project in that directory using react-native init ? Commented Nov 20, 2015 at 9:43
  • If you follow the Getting Started Doc on facebook.github.io/react-native/docs/… you shouldn´t get this issue. Just look if you installed the requirements and than follow the Quick Start Guide everything should be fine...Where did you run the command? Commented Nov 20, 2015 at 20:42
  • @Andrea yes i followed this but the issue was within HAXM now its working Thanks, Commented Nov 21, 2015 at 7:04
  • This to me was happening for an old version of node Commented Aug 1, 2019 at 18:59

11 Answers 11

19

You can try to do npm install before react-native run-android

Sign up to request clarification or add additional context in comments.

3 Comments

i installed npm using npm install but still its saying Command run-android unrecognized. Make sure that you have run npm install and that you are inside a react-native project.
@sud007 What is the issue you are facing? Please post the error and steps you are following
I had to delete the node_modules folder first and then run npm install again to get mine to run react-native run-android again.
8

First we have to install react-native then upgrade packages if you need and run android.

npm install --save react-native@latest

react-native upgrade

react-native run-android

Comments

6

A lot of developers fail to mention the crucial point,that certain commands require you to be a particular directory. In this case, to "react-native run-android", you have to be in your project directory!

Comments

3

Command run-android unrecognized. Make sure that you have run npm install and that you are inside a react-native project.

I faced this issue, the problem is we need to navigate to or project folder.

example: I created the project in "MyApps" with app name "DemoApp" in D drive

the command line root should be like this: D:\MyApps\DemoApp>react-native run-android

now it will run with out any issue.

The problem is your android related info is presents inside the app not t=in the main directory.

Comments

1

I was facing the same problem and the above solutions did not work. Try using:

yarn add react-native-cli

4 Comments

Also this not work for ma it's says "'yarn' is not recognized as an internal or external command, operable program or batch file."
you need too install yarn first
and How to do that ?
@VISH you should use npm i -g react-native-cli
1

First of all please see if devices/emulator is attached and working by following command

adb devices

there should be some devices showing connected
it is better to restart/reconnect you emulator/device and then try to run application again
if not working you can also try

npm install 

Comments

1

You need to make sure that you are inside the project like cd AwesomeProject and do npm i and after that execute npx react-native run-android

Comments

0

In my case the problem was that I was in the android folder of my project due to this command cd android && ./gradlew assembleRelease.So the solution was to cd ../ and come to root of project and then running this command

react-native run-android --variant=release

ran fine.

Comments

0

For me the issue was I was not inside the project directory AwesomeProject( Project that I created using this command :

react-native init AwesomeProject )

Comments

0

I got it fixed after adding Android sdk-tools to PATH, and restarting VSCode/Terminal.

/Users/<username>/Library/Android/sdk/build-tools

Earlier my path set to

/Users/<username>/Library/Android/sdk

Comments

-2

1.make sure java jdk installed 2.make sure npm installed in your project root folder 3.this works for me

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.