16/04/2016
Installation React Native
First install Homebrew using the instructions on the Homebrew website, then install Node.js by executing the following in a Terminal window:
$ brew install node
Next, use homebrew to install watchman, a file watcher from Facebook:
$ brew install watchman
This is used by React Native to figure out when your code changes and rebuild accordingly. It’s like having Xcode do a build each time you save your file.
Next use npm to install the React Native Command Line Interface (CLI) tool:
$ npm install -g react-native-cli
Navigate to the folder where you would like to develop your React Native application, and use the CLI tool to construct the project:
$ react-native init PropertyFinder
This creates a starter-project containing everything you need to build and run a React Native application.
( If you get complaints about the version of node, make sure the one installed by brew is the one in use. Run brew link --overwrite node in the terminal. )
Android Setup
- Install Git
- On Mac:
- brew install git
- On Linux:
- install Git via your package manager.
- On Windows:
- download and install Git for Windows. During the setup process, choose "Run Git from Windows Command Prompt", which will add Git to your PATHenvironment variable.
- Install the Android SDK (unless you already have it)
- Install the latest JDK
- Install the Android SDK:
- On Mac: brew install android-sdk
- On Linux and Windows: Download from the Android website
Define the ANDROID_HOME environment variable
IMPORTANT: Make sure the ANDROID_HOME environment variable points to your existing Android SDK:
- On Mac, add this to your ~/.bashrc, ~/.bash_profile or whatever your shell uses:
- If you installed the SDK via Homebrew, otherwise ~/Library/Android/sdk
- export ANDROID_HOME=/usr/local/opt/android-sdk
- On Linux, add this to your ~/.bashrc, ~/.bash_profile or whatever your shell uses:export ANDROID_HOME=
- On Windows, go to Control Panel -> System and Security -> System -> Change settings -> Advanced -> Environment variables -> New
NOTE: You need to restart the Command Prompt (Windows) / Terminal Emulator (Mac OS X, Linux) to apply the new Environment variables.
Use gradle daemon
React Native Android use gradle as a build system. We recommend to enable gradle daemon functionality which may result in up to 50% improvement in incremental build times for changes in java code. Learn here how to enable it for your platform.
$ brew install gradle