Getting Started on Linux # | Edit on GitHub |
This guide is essentially a beginner-friendly version of the Getting Started page for React Native on Linux.
For the purposes of this guide, we assume that you're working on Ubuntu Linux 14.04 LTS.
Before following this guide, you should have installed the Android SDK and run a successful Java-based "Hello World" app for Android.
See Android Setup for details.
The first thing you need to do is to install NodeJS, a popular Javascript implementation.
Fire up the Terminal and paste the following commands to install NodeJS from the NodeSource repository:
NOTE: The above instructions are for Ubuntu. If you're on a different distro, please follow the instructions on the NodeJS website.
watchman is a tool by Facebook for watching changes in the filesystem. You need to install it for better performance and avoid a node file-watching bug.
Paste the following into your terminal to compile watchman from source and install it:
Flow is a static type checker for JavaScript. To install it, paste the following in the terminal:
Let's set up an Android device to run our starter project.
First thing is to plug in your device and check the manufacturer code by using lsusb
, which should output something like this:
These lines represent the USB devices currently connected to your machine.
You want the line that represents your phone. If you're in doubt, try unplugging your phone and running the command again:
You'll see that after removing the phone, the line which has the phone model ("Motorola PCS" in this case) disappeared from the list. This is the line that we care about.
Bus 001 Device 003: ID 22b8:2e76 Motorola PCS
From the above line, you want to grab the first four digits from the device ID:
22b8:2e76
In this case, it's 22b8
. That's the identifier for Motorola.
You'll need to input this into your udev rules in order to get up and running:
Make sure that you replace 22b8
with the identifier you get in the above command.
Now check that your device is properly connecting to ADB, the Android Debug Bridge, by using adb devices
.
For more information, please see the docs for running an Android app on your device.
Your Android device and your tools are all ready to go. You can now follow the instructions in the Quick Start guide to install React Native and start your first project.