react-native--build react native Android development environment on Mac

Source: Internet
Author: User

Required: Jdk,android sdk,node.js1. Installing the JDKGo to Java official website download list select Mac OS X version x642. Install the Android SDKAlthough Google Now recommends using Android Studio, I chose to install the Android SDK separately. This is a relatively full directory, the above link is official, there are wall, with the following basic is the network disk resources, speed can also, remember to modify the Android SDK online update mirror server. PS: After installing API 23 in the Android SDK manager, be sure to set the environment variable: Go to the user's home directory
$CD ~
Then if the. bash_profile file does not exist under the directory, the file is created
$Touch . Bash_profile
Open the file
$open. Bash_profile
Then add the following two lines to the file, {/your/sdk/path/} is the path to your SDK folder
Export Android_home={/your/sdk/path/}android-sdk-macosxexport Path=${path}: $ANDROID _home/tools: $ANDROID _home/ Platform-tools
Save and exit, and then execute
$source. Bash_profile
Last Test.
$ADB version
Appear android Debug Bridge version 1.0.32 input $android will open Android SDK manager from this, set environment variable successfully3. Install NVM, node. js, Watchman, Flow(1) The official said to recommend the use of homebrew installation NVM, Watchman, flow. After installing NVM, run
Install NODE$NVM alias Default node
The install command may need to be preceded by the sudo command to enter a password as prompted to install the latest version of node. JS (2) You can also download the input $node-v directly from the node. JS website to detect whether the installation was successful4. Installing REACT-NATIVE-CLI
Install -G react-native-cli
-G means the global installation
$open/usr/local/lib/node_modules
You can see all the packages that NPM has installed globally5. Initializing the sample project
$react-native Init awesomeproject
Need to wait a while and then open
$cd awesomeproject$react-native run-android
The first run may install Gradle, the speed is a bit slow, be patient, and so on ... PS: Test recommended to use the real machine, Android virtual machine boot speed do not want to spit groove ... When the real machine debugging, if a red, "Unable to download JS bundle", please shake the phone, in the pop-up menu select Dev Settings, choose Debug Server Host for device, and then enter the computer's IP address, At this point the phone to the computer (the compilation environment) in the same WiFi environment Welcome interface:6. Edit the CodeOpen Index.android.js and modify part of the code, save shake the phone, point reload JS, you can see the interface changes (add static resources, need to recompile) reference: http://wiki.jikexueyuan.com/project/ React-native/gettingstarted.html

react-native--build react native Android development environment on Mac

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.