Teach you to build react Native Android development environment under Windows

Source: Internet
Author: User

Recently saw react native like a good look, curiosity driven to experience a bit and will be under the window to build react Natvie Android environment of the steps recorded, and have the needs of friends reference. (I refer to the official documentation)

React-native's github address: https://github.com/facebook/react-native

React-native's document Address: http://facebook.github.io/react-native/docs/getting-started.html

1. Preparatory work:

Open the document and click on ' Android Setup ' to see what you need

(a) Installing Git from Windows (fool-mounted)

(b) Android SDK (Configure Android_home environment)

(c) built with Gradle (if you are already using Android Studio these can be ignored)

Note: (The work must be ready or the last mistake will be good pit)

Both of the above images suggest that we need to install node. js and open the link to download node. js for installation (fool-only installation). Download the latest in here.

2. Start

Open cmd Run execute the following command

$ NPM install-g react-native-cli

$ react-native init awesomeproject

Above this command download Awsomeproject, if not downloaded can be downloaded on my GitHub awesomeproject.

The awesome that the command line downloads online is placed by default in the user folder.

Note: Awesomproject under the anroid under the Local.properties file is not, here I copy from other projects directly come over.

Next, reopen a cmd and switch to the Awesomproject directory

Perform NPM start, the prompt is displayed, and then enter the react-native Start command. If that proves your service has started, here we can see that the port of the service is 8081.

We certify in the browser whether the service is started:

Enter address in browser: http://localhost:8081/index.android.bundle?platform=android

If so, it proves that the service has been started. If not started, then there is no need to do it ~ ~ ~ Directly Break It

Finally we compile and run Awesomeproject. A little excited .... Remember to open the Genymotin simulator or connect to the real machine first.

Execute react-native run-android command

If so, it means that the Awesomeproject project was compiled successfully.

Finally is such a son ~ ~ ~ ~ ~ ~ ~ ~ (changed the effect of index.android.js)

Real machine needs network in the same LAN (open a WiFi hotspot on it)

Running on a real machine occurs when the following is the case ... What to do

(This mobile phone system is 5.0.1)

In official documents you can see

Execute ADB reverse tcp:8081 tcp:8081 command

Then click reloadjs~~~

The above errors, please understand and correct them.

Teach you to build react Native Android development environment under Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.