React-native: Unrecognized command 'android' with react-native 0.31

Created on 9 Aug 2016  路  19Comments  路  Source: facebook/react-native

screen shot 2016-08-09 at 5 19 02 pm

Locked

Most helpful comment

@Flavien With latest of RN
react-native upgrade does the complete work for you

All 19 comments

can you run ls in your project and post the results?

I depend on the react-native android command for generating the project. This allows me to blow away the android directory. I do this because I like to create a lot of smaller react-native apps for experimentation, and the disk space starts to add up if I don't delete ios and android.

Is there a away around this, or perhaps a different approach I should take for maintaining lots of little, unrelated react-native projects?

@satya164 The android folder structure goes this way on react-native upgrade
screen shot 2016-08-09 at 10 01 31 pm

subscribing.
I nuke my android folder sometimes. What happened to react-native android?

My current work-around is to have a generate-android-project.js script that looks like this:

const fs = require('fs');
const generate = require('react-native/local-cli/generate/generate.js');

generate([
  '--platform', 'android',
  '--project-path', process.cwd(),
  '--project-name', JSON.parse(
    fs.readFileSync('package.json', 'utf8')
  ).name,
]);

Then you can just:

node generate-android-project.js

This has the exact same effect as:

react-native android

But what about react-native android?
There has to be replacement command for this instead

I have this issue as well. I have run react-native upgrade. Even the script workaround is not working. Using "react-native": "0.31.0".

$ react-native run-android
Android project not found. Maybe run react-native android first?

$ react-native android
  Unrecognized command 'android'
  Run react-native --help to see list of all available commands

$ ls
RouterConfig.js     components      ios         package.json
android         index.android.js    node_modules
assets          index.ios.js        notes

cc @grabbou @Kureev can you take a look at this one please?

This should be reopened as this still happens on the latest version.

@Flavien With latest of RN
react-native upgrade does the complete work for you

I still get the Android project not found error after running react-native upgrade, and it still suggests running a non-existent command. This should be reopened.

@cogwheel any fix for adding android/ios folders to an RN project?

@SupriyaKalghatgi Thanks for your update.

This should be definitely re-opened as it causes the same error.

image

OK. My Problem got fixed by enabling Virtual Device from BIOS in Windows 10 and ran the emulator in Background (I am novice to Android)! But still, why it didn't run in my connected Android device directly ?

thanks @SupriyaKalghatgi

Whats the final answer ? me too am stuck

@huxaiphaer react-native upgrade hopes this will help as said by @SupriyaKalghatgi

Was this page helpful?
0 / 5 - 0 ratings