简体   繁体   中英

Steps to run a react native project in android studio after eject from create react native

What are the steps to run a react native project in android studio after eject from create react native. I didn't find a helpful step by step description online for this. I am pretty new to android development, facing different problems related to gradle versions and other stuffs in android. Do I need to run it from android studio , or just need to run the command npm run android

Install React Native using Mac OS

Please check React Native Document before start. https://facebook.github.io/react-native/docs/getting-started.html

If you don't have install brew in your computer then must hit that command line.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then Follow the Command step to step

brew install node

Once Complete node step up then you must Create React Native Directory in your Computer to do this follow the Following Steps:

Open Terminal and hit…

cd

cd Documents

mkdir react-native

cd react-native/

Now You create your React Native Directory now once it's done.

Node comes with npm, which lets you install the React Native command line interface.

Run the following command in a Terminal:

npm i react-native-cli - g

it need some time to complete install once it's done make sure you check it's npm version to do that hit the following command line.

npm -v 

So you get your version code if you are using 4.6.1 above then maybe you are using some of the problems so remove above version and use this of a version using this command line.

npm I -g npm@4.6.1

Hit enter and you start with that npm version. So it's Done now Follow the React Native Document if you are using Android and iOS then you can follow the Steps but skip installation node step because we set up all those steps and once you are using Setup Android or Xcode in your pc Follow the Command to run React Native app.

Using your React Native Folder that you create in a directory like this

cd

cd Documents

mkdir react-native

cd react-native/

react-native init HelloWorld

Here we are Create our HelloWorld Programme Using Android Studio and React Native.

Once you have ejected you need to run below commands

  • exp run
  • react-native run-android

Make sure exp is installed. exp run will serve the js bundle locally which will be accessed when your android app runs via react-native run-android command on simulator or connected device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM