[英]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. 在从弹出创建反应本机后, 在android studio中运行react本机项目的步骤是什么。 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. 我对Android开发很新,面对与gradle版本相关的不同问题以及android中的其他东西。 Do I need to run it from android studio , or just need to run the command npm run android
我是否需要从android studio运行它,或者只需要运行命令npm run android
Install React Native using Mac OS 使用Mac OS安装React Native
Please check React Native Document before start. 请在开始之前检查React Native Document。 https://facebook.github.io/react-native/docs/getting-started.html 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. 如果您的计算机中没有安装brew,则必须点击该命令行。
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then Follow the Command step to step 然后按照Command步骤进行操作
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: 完成节点后,您必须在计算机中创建React Native Directory才能执行以下步骤:
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. 现在,一旦完成,您就可以创建React Native Directory。
Node comes with npm, which lets you install the React Native command line interface. Node附带了npm,它允许您安装React Native命令行界面。
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版本来执行以下命令行。
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. 因此,如果您使用上面的4.6.1,那么您将获得您的版本代码,那么您可能正在使用某些问题,因此请删除以上版本并使用此命令行使用此版本。
npm I -g npm@4.6.1
Hit enter and you start with that npm version. 按Enter键,然后从npm版本开始。 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. 所以它现在完成如果你使用的是Android和iOS,那么你可以按照步骤跳过安装节点,因为我们设置了所有这些步骤,一旦你在你的电脑上使用安装程序Android或Xcode,请按照命令运行React Native应用程序。
Using your React Native Folder that you create in a directory like this 使用您在此类目录中创建的React Native Folder
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. 在这里,我们使用Android Studio和React Native创建我们的HelloWorld程序。
Once you have ejected you need to run below commands 一旦弹出,你需要运行以下命令
Make sure exp
is installed. 确保已安装exp
。 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. exp run
将在本地提供js包,当你的android应用程序通过模拟器或连接设备上的react-native run-android
命令运行时将访问它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.