Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I had an issue in my React-Native project which was working fine earlier but suddenly it stopped working. Whenever I used the command:

react-native run-android 

I was getting an error:

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

I tried running:

react-native android 

But it said:

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

After trying:

D:\ProjectRoot\ReactNativeProjects\AwesomeProject>react-native eject 

The error returned was:

Scanning folders for symlinks in D:\ProjectRoot\ReactNativeProjects\AwesomeProject\node_modules (48ms) App name must be defined in the app.json config file to define the project name. It must not contain any spaces or dashes.

This is the app.json file:

{   "expo": {     "name": "AwesomeProject",     "description": "A very interesting project.",     "slug": "AwesomeProject",     "privacy": "public",     "sdkVersion": "30.0.0",     "platforms": ["ios", "android"],     "ios": {       "supportsTablet": true     },     "android": {       "package": "com.project.first"     },     "version": "1.0.0",     "orientation": "portrait",     "icon": "./assets/images/icon.png",     "splash": {       "image": "./assets/images/splash.png",       "resizeMode": "contain",       "backgroundColor": "#ffffff"     },     "updates": {       "fallbackToCacheTimeout": 0     },     "assetBundlePatterns": [       "**/*"     ]   } } 
like image 996
udai Avatar asked May 01 '17 18:05

udai


People also ask

How do you run a project Expo?

Running your React Native applicationInstall the Expo Go app on your iOS or Android phone and connect to the same wireless network as your computer. On Android, use the Expo Go app to scan the QR code from your terminal to open your project. On iOS, use the built-in QR code scanner of the default iOS Camera app.


1 Answers

I raised this question and answered myself as I thought it will help others who are facing similar issue. I struggled a lot to find out the real reason behind it as the error shown in terminal was not precise.

To resolve the issue please upgrade the react-native package.

  1. Go to the Project root.

  2. Upgrade the React native package in the Command Prompt by typing :

    react-native upgrade.

  3. Then Accept to update all the Files by typing y (Yes) in the Command Prompt.

Reference: https://github.com/facebook/react-native/issues/9312

like image 89
udai Avatar answered Sep 21 '22 07:09

udai