Deepak Patidar
Deepak Patidar

Reputation: 394

React-Native run-android command issue

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?

Upvotes: 12

Views: 61895

Answers (11)

Bharathi K
Bharathi K

Reputation: 1

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

Upvotes: -2

Yazan Najjar
Yazan Najjar

Reputation: 2206

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

Upvotes: 1

Suresh
Suresh

Reputation: 835

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

Upvotes: 0

Yeshi
Yeshi

Reputation: 373

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

react-native init AwesomeProject )

Upvotes: 0

Sultan Ali
Sultan Ali

Reputation: 2589

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 

Upvotes: 1

Ebe
Ebe

Reputation: 61

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!

Upvotes: 6

Surya Reddy
Surya Reddy

Reputation: 1263

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.

Upvotes: 3

Singam
Singam

Reputation: 1655

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

Upvotes: 8

Black Mamba
Black Mamba

Reputation: 15615

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.

Upvotes: 0

Alex
Alex

Reputation: 1505

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

yarn add react-native-cli

Upvotes: 1

Gathole
Gathole

Reputation: 932

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

Upvotes: 19

Related Questions