Add tabs to Getting Started and update Android Studio steps

Summary:
There are two ways to get started with React Native: using CRNA, or by building native code. The latter requires a set of dependencies that also need to be installed even by people who use CRNA if they have ejected.

There needs to be a clear demarcation between the two approaches as well as clear instructions as to which steps are of interest to CRNA using parties or people adding RN to an existing app.

Separating the two approaches entirely by using tabs can achieve this purpose.

Built and tested the website on Chrome on macOS. Have not yet tested other browsers or OS configurations.

![screencapture-localhost-8079-react-native-docs-getting-started-html-1494974542733](https://cloud.githubusercontent.com/assets/165856/26131374/77258b0c-3a4e-11e7-9a17-074610ca33d1.png)

![screencapture-localhost-8079-react-native-docs-getting-started-html-1494974580882](https://cloud.githubusercontent.com/assets/165856/26131370/73806990-3a4e-11e7-9e67-73c519b050da.png)

This is a work in progress. Feedback is appreciated. I am not yet happy with the different sets of tabs/buttons, for example.
Closes https://github.com/facebook/react-native/pull/14005

Differential Revision: D5096426

Pulled By: hramos

fbshipit-source-id: cdbf19b148ec87f2f2dfdced345084d0bbff4c26
This commit is contained in:
Hector Ramos 2017-05-19 14:42:52 -07:00 committed by Facebook Github Bot
parent 2f71270569
commit 2bf512b58c
17 changed files with 315 additions and 189 deletions

View File

@ -7,51 +7,48 @@ permalink: docs/getting-started.html
next: tutorial
---
Welcome to React Native! This page will help you install React Native on
your system, so that you can build apps with it right away. If you already
have React Native installed, you can skip ahead to the
[Tutorial](docs/tutorial.html).
## Quick Start
[Create React Native App](https://github.com/react-community/create-react-native-app) is the easiest way to start building a new React Native application. It allows you to start a project without installing or configuring any tools to build native code.
No Xcode or Android Studio installation is required. Assuming that you have Node installed, you can run the following commands to create a new React Native project called "AwesomeProject":
```
npm install -g create-react-native-app
create-react-native-app AwesomeProject
cd AwesomeProject
npm start
```
This will start a development server for you, and print a QR code in your terminal.
Install the [Expo](https://expo.io) client app on your iOS or Android phone, make sure your phone is on the same network as your computer, and scan the QR code in your terminal to open your project. Create React Native App also has a [user guide](https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md) you can reference if you have questions specific to the tool.
Once you've created your project and opened it in the Expo client app, you can proceed to the [Tutorial](docs/tutorial.html).
### Caveats
The Expo client app usually releases about 1 week after any given React Native release, and Create React Native App always provides the latest version of React Native which is supported by the Expo client. You can check [this document](https://github.com/react-community/create-react-native-app/blob/master/VERSIONS.md) to find out what versions are supported.
Because you don't build any native code with Create React Native App, it's not possible to include custom native modules beyond the React Native APIs and components that are available in the Expo client app.
If you know that you'll eventually need to include your own native code, Create React Native App is still a good way to get started. In that case you'll just need to "[eject](https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#ejecting-from-create-react-native-app)" eventually to create your own native builds. If you do eject, the native build instructions below will be required to continue working on your project.
If you're integrating React Native into an existing project, you'll want to skip Create React Native App and go directly to setting up the native build environment. See below for instructions on configuring a native build environment for React Native.
<hr style="margin-top:25px"/>
## Building Projects with Native Code
Follow these instructions if you need to build native code in your project. For example, if you "ejected" from Create React Native app, or if you are integrating React Native into an existing application, you'll need this section.
The instructions are a bit different depending on your development operating system, and whether you want to start developing for iOS or Android. If you want to develop for both iOS and Android, that's fine - you just have to pick
one to start with, since the setup is a bit different.
<div class="toggler">
<style>
.toggler li {
display: inline-block;
position: relative;
top: 1px;
padding: 10px;
margin: 0px 2px 0px 2px;
border: 1px solid #05A5D1;
border-bottom-color: transparent;
border-radius: 3px 3px 0px 0px;
color: #05A5D1;
background-color: transparent;
font-size: 0.99em;
cursor: pointer;
}
.toggler li:first-child {
margin-left: 0;
}
.toggler li:last-child {
margin-right: 0;
}
.toggler ul {
width: 100%;
display: inline-block;
list-style-type: none;
margin: 0;
border-bottom: 1px solid #05A5D1;
cursor: default;
}
@media screen and (max-width: 960px) {
.toggler li,
.toggler li:first-child,
.toggler li:last-child {
display: block;
border-bottom-color: #05A5D1;
border-radius: 3px;
margin: 2px 0px 2px 0px;
}
.toggler ul {
border-bottom: 0;
}
}
.toggler a {
display: inline-block;
padding: 10px 5px;
@ -60,6 +57,8 @@ one to start with, since the setup is a bit different.
border-radius: 3px;
text-decoration: none !important;
}
.display-guide-quickstart .toggler .button-quickstart,
.display-guide-native .toggler .button-native,
.display-os-mac .toggler .button-mac,
.display-os-linux .toggler .button-linux,
.display-os-windows .toggler .button-windows,
@ -69,58 +68,140 @@ one to start with, since the setup is a bit different.
color: white;
}
block { display: none; }
.display-platform-ios.display-os-mac .ios.mac,
.display-platform-ios.display-os-linux .ios.linux,
.display-platform-ios.display-os-windows .ios.windows,
.display-platform-android.display-os-mac .android.mac,
.display-platform-android.display-os-linux .android.linux,
.display-platform-android.display-os-windows .android.windows {
.display-guide-quickstart.display-platform-ios.display-os-mac .quickstart.ios.mac,
.display-guide-quickstart.display-platform-ios.display-os-linux .quickstart.ios.linux,
.display-guide-quickstart.display-platform-ios.display-os-windows .quickstart.ios.windows,
.display-guide-quickstart.display-platform-android.display-os-mac .quickstart.android.mac,
.display-guide-quickstart.display-platform-android.display-os-linux .quickstart.android.linux,
.display-guide-quickstart.display-platform-android.display-os-windows .quickstart.android.windows, .display-guide-native.display-platform-ios.display-os-mac .native.ios.mac,
.display-guide-native.display-platform-ios.display-os-linux .native.ios.linux,
.display-guide-native.display-platform-ios.display-os-windows .native.ios.windows,
.display-guide-native.display-platform-android.display-os-mac .native.android.mac,
.display-guide-native.display-platform-android.display-os-linux .native.android.linux,
.display-guide-native.display-platform-android.display-os-windows .native.android.windows {
display: block;
}
</style>
<span>Mobile OS:</span>
<a href="javascript:void(0);" class="button-ios" onclick="display('platform', 'ios')">iOS</a>
<a href="javascript:void(0);" class="button-android" onclick="display('platform', 'android')">Android</a>
<br />
<span>Development OS:</span>
<a href="javascript:void(0);" class="button-mac" onclick="display('os', 'mac')">macOS</a>
<a href="javascript:void(0);" class="button-linux" onclick="display('os', 'linux')">Linux</a>
<a href="javascript:void(0);" class="button-windows" onclick="display('os', 'windows')">Windows</a>
This page will help you install and build your first React Native app. If you already have React Native installed, you can skip ahead to the [Tutorial](docs/tutorial.html).
<div class="toggler">
<ul role="tablist" >
<li id="quickstart" class="button-quickstart" aria-selected="false" role="tab" tabindex="0" aria-controls="quickstarttab" onclick="display('guide', 'quickstart')">
Quick Start
</li>
<li id="native" class="button-native" aria-selected="false" role="tab" tabindex="-1" aria-controls="nativetab" onclick="display('guide', 'native')">
Building Projects with Native Code
</li>
</ul>
</div>
<block class="linux windows ios" />
<block class="quickstart mac windows linux ios android" />
[Create React Native App](https://github.com/react-community/create-react-native-app) is the easiest way to start building a new React Native application. It allows you to start a project without installing or configuring any tools to build native code - no Xcode or Android Studio installation required (see [Caveats](docs/getting-started.html#caveats)).
Assuming that you have [Node](https://nodejs.org/en/download/) installed, you can use npm to install the `create-react-native-app` command line utility:
```
npm install -g create-react-native-app
```
Then run the following commands to create a new React Native project called "AwesomeProject":
```
create-react-native-app AwesomeProject
cd AwesomeProject
npm start
```
This will start a development server for you, and print a QR code in your terminal.
## Running your React Native application
Install the [Expo](https://expo.io) client app on your iOS or Android phone and connect to the same wireless network as your computer. Using the Expo app, scan the QR code from your terminal to open your project.
### Modifying your app
Now that you have successfully run the app, let's modify it. Open `App.js` in your text editor of choice and edit some lines. The application should reload automatically once you save your changes.
### That's it!
Congratulations! You've successfully run and modified your first React Native app.
<center><img src="img/react-native-congratulations.png" width="150"></img></center>
## Now what?
- If you're curious to learn more about React Native, continue on
to the [Tutorial](docs/tutorial.html).
- Create React Native App also has a [user guide](https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md) you can reference if you have questions specific to the tool.
- If you can't get this to work, see the [Troubleshooting](https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#troubleshooting) section in the README for Create React Native App.
### Caveats
Because you don't build any native code when using Create React Native App to create a project, it's not possible to include custom native modules beyond the React Native APIs and components that are available in the Expo client app.
If you know that you'll eventually need to include your own native code, Create React Native App is still a good way to get started. In that case you'll just need to "[eject](https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#ejecting-from-create-react-native-app)" eventually to create your own native builds. If you do eject, the "Building Projects with Native Code" instructions will be required to continue working on your project.
If you're integrating React Native into an existing project, you'll want to skip Create React Native App and go directly to setting up the native build environment. Select "Building Projects with Native Code" above for instructions on configuring a native build environment for React Native.
<block class="native mac windows linux ios android" />
<p>Follow these instructions if you need to build native code in your project. For example, if you are integrating React Native into an existing application, or if you "ejected" from <a href="docs/getting-started.html" onclick="display('guide', 'quickstart')">Create React Native App</a>, you'll need this section.</p>
The instructions are a bit different depending on your development operating system, and whether you want to start developing for iOS or Android. If you want to develop for both iOS and Android, that's fine - you just have to pick
one to start with, since the setup is a bit different.
<div class="toggler">
<span>Development OS:</span>
<a href="javascript:void(0);" class="button-mac" onclick="display('os', 'mac')">macOS</a>
<a href="javascript:void(0);" class="button-windows" onclick="display('os', 'windows')">Windows</a>
<a href="javascript:void(0);" class="button-linux" onclick="display('os', 'linux')">Linux</a>
<span>Target OS:</span>
<a href="javascript:void(0);" class="button-ios" onclick="display('platform', 'ios')">iOS</a>
<a href="javascript:void(0);" class="button-android" onclick="display('platform', 'android')">Android</a>
</div>
<block class="native linux windows ios" />
## Unsupported
<div>Unfortunately, Apple only lets you develop for iOS on a Mac. If you want to build an iOS app but you don't have a Mac yet, you can try starting with the <a href="" onclick="display('platform', 'android')">Android</a> instructions instead.</div>
<blockquote><p>A Mac is required to build projects with native code for iOS. You can follow the <a href="docs/getting-started.html" onclick="display('guide', 'quickstart')">Quick Start</a> to learn how to build your app using Create React Native App instead.</p></blockquote>
<center><img src="img/react-native-sorry-not-supported.png" width="150"></img></center>
<block class="native mac ios" />
<block class="mac ios" />
## Installing Dependencies
## Installing dependencies
You will need Node, Watchman, the React Native command line interface, and Xcode.
<block class="mac android" />
While you can use any editor of your choice to develop your app, you will need to install Xcode in order to set up the necessary tooling to build your React Native app for iOS.
## Installing Dependencies
<block class="native mac android" />
## Installing dependencies
You will need Node, Watchman, the React Native command line interface, a JDK, and Android Studio.
<block class="linux android" />
<block class="native linux android" />
## Installing Dependencies
## Installing dependencies
You will need Node, the React Native command line interface, a JDK, and Android Studio.
<block class="windows android" />
<block class="native windows android" />
## Installing Dependencies
## Installing dependencies
You will need Node, the React Native command line interface, Python2, a JDK, and Android Studio.
<block class="mac ios android" />
<block class="native mac windows linux android" />
While you can use any editor of your choice to develop your app, you will need to install Android Studio in order to set up the necessary tooling to build your React Native app for Android.
<block class="native mac ios android" />
### Node, Watchman
@ -135,21 +216,21 @@ If you have already installed Node on your system, make sure it is version 4 or
[Watchman](https://facebook.github.io/watchman) is a tool by Facebook for watching changes in the filesystem. It is highly recommended you install it for better performance.
<block class="linux android" />
<block class="native linux android" />
### Node
Follow the [installation instructions for your Linux distribution](https://nodejs.org/en/download/package-manager/) to install Node 4 or newer.
Follow the [installation instructions for your Linux distribution](https://nodejs.org/en/download/package-manager/) to install Node 6 or newer.
<block class='windows android' />
<block class='native windows android' />
### Node, Python2, JDK
We recommend installing Node and Python2 via [Chocolatey](https://chocolatey.org), a popular package manager for Windows.
Android Studio, which we will install next, requires a recent version of the [Java SE Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) which can be installed using Chocolatey.
React Native also requires a recent version of the [Java SE Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), as well as Python 2. Both can be installed using Chocolatey.
Open a Command Prompt as Administrator, then run:
Open an Administrator Command Prompt (right click Command Prompt and select "Run as Administrator"), then run the following commands:
```
choco install nodejs.install
@ -159,9 +240,9 @@ choco install jdk8
If you have already installed Node on your system, make sure it is version 4 or newer. If you already have a JDK on your system, make sure it is version 8 or newer.
> You can find additional installation options on [Node.js's Downloads page](https://nodejs.org/en/download/).
> You can find additional installation options on [Node's Downloads page](https://nodejs.org/en/download/).
<block class="mac ios android" />
<block class="native mac ios android" />
### The React Native CLI
@ -175,13 +256,13 @@ npm install -g react-native-cli
> If you get an error like `Cannot find module 'npmlog'`, try installing npm directly: `curl -0 -L https://npmjs.org/install.sh | sudo sh`.
<block class="windows linux android" />
<block class="native windows linux android" />
### The React Native CLI
Node comes with npm, which lets you install the React Native command line interface.
Run the following command in a Terminal:
Run the following command in a Command Prompt or shell:
```
npm install -g react-native-cli
@ -189,7 +270,7 @@ npm install -g react-native-cli
> If you get an error like `Cannot find module 'npmlog'`, try installing npm directly: `curl -0 -L https://npmjs.org/install.sh | sudo sh`.
<block class="mac ios" />
<block class="native mac ios" />
### Xcode
@ -197,58 +278,66 @@ The easiest way to install Xcode is via the [Mac App Store](https://itunes.apple
If you have already installed Xcode on your system, make sure it is version 8 or higher.
#### Command Line Tools
You will also need to install the Xcode Command Line Tools. Open Xcode, then choose "Preferences..." from the Xcode menu. Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.
![Xcode Command Line Tools](img/XcodeCommandLineTools.png)
<block class="mac linux windows android" />
<block class="native mac linux android" />
### Android Development Environment
### Java Development Kit
React Native requires a recent version of the Java SE Development Kit (JDK). [Download and install JDK 8 or newer](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) if needed.
<block class="native mac linux windows android" />
### Android development environment
Setting up your development environment can be somewhat tedious if you're new to Android development. If you're already familiar with Android development, there are a few things you may need to configure. In either case, please make sure to carefully follow the next few steps.
<block class="mac linux android" />
> Android Studio requires a recent version of the [Java SE Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). Go ahead and install JDK 8 or newer if needed.
<block class="mac linux windows android" />
<block class="native mac windows linux android" />
#### 1. Install Android Studio
Android Studio provides the Android SDK and Android Virtual Device (emulator) required to run and test your React Native apps. Download and install [Android Studio](https://developer.android.com/studio/index.html).
[Download and install Android Studio](https://developer.android.com/studio/index.html). Choose a "Custom" setup when prompted to select an installation type. Make sure the boxes next to all of the following are checked:
Once the installation process is completed, launch Android Studio. Choose "Custom" when prompted to select an installation type. Make sure the boxes next to all of the following are checked:
<block class="mac windows android" />
<block class="native mac windows android" />
- `Android SDK`
- `Android SDK Platform`
- `Performance (Intel ® HAXM)`
- `Android Virtual Device`
Then, click "Next" to install all of these components.
<block class="linux android" />
<block class="native linux android" />
- `Android SDK`
- `Android SDK Platform`
- `Android Virtual Device`
Click "Next" to install all of these components, then [configure VM acceleration](https://developer.android.com/studio/run/emulator-acceleration.html#vm-linux) on your system.
<block class="native mac windows linux android" />
<block class="windows android" />
Then, click "Next" to install all of these components.
> You may also install Intel ® HAXM by following [these instructions](https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-windows).
> If the checkboxes are grayed out, you will have a chance to install these components later on.
<block class="mac android" />
Once setup has finalized and you're presented with the Welcome screen, proceed to the next step.
> You may also install Intel ® HAXM by following [these instructions](https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-mac-os-x).
#### 2. Install the Android SDK
<block class="windows mac linux android" />
Android Studio installs the latest Android SDK by default. Building a React Native app with native code, however, requires the `Android 6.0 (Marshmallow)` SDK in particular. Additional Android SDKs can be installed through the SDK Manager in Android Studio.
#### 2. Install the Android 6.0 (Marshmallow) SDK
The SDK Manager can be accessed from the "Welcome to Android Studio" screen. Click on "Configure", then select "SDK Manager".
Android Studio installs the most recent Android SDK by default. React Native, however, requires the `Android 6.0 (Marshmallow)` SDK. You can use the SDK Manager to install additional SDK platforms. To access the SDK Manager, click on "Configure", then select "SDK Manager" from the "Welcome to Android Studio" screen.
<block class="native mac android" />
![Android Studio Welcome](img/AndroidStudioWelcomeMacOS.png)
<block class="native windows android" />
![Android Studio Welcome](img/AndroidStudioWelcomeWindows.png)
<block class="native mac windows linux android" />
> The SDK Manager can also be found within the Android Studio "Preferences" dialog, under **Appearance & Behavior****System Settings****Android SDK**.
@ -259,45 +348,45 @@ Select the "SDK Platforms" tab from within the SDK Manager, then check the box n
- `Intel x86 Atom_64 System Image`
- `Google APIs Intel x86 Atom_64 System Image`
<block class="mac android" />
<block class="native mac android" />
![Android SDK Manager](img/AndroidSDKManagerMacOS.png)
<block class="windows android" />
<block class="native windows android" />
![Android SDK Manager](img/AndroidSDKManagerWindows.png)
<block class="windows mac linux android" />
<block class="native windows mac linux android" />
Next, select the "SDK Tools" tab and check the box next to "Show Package Details" here as well. Look for and expand the "Android SDK Build-Tools" entry, then make sure that `23.0.1` is selected.
<block class="mac android" />
<block class="native mac android" />
![Android SDK Manager - 23.0.1 Build Tools](img/AndroidSDKManagerSDKToolsMacOS.png)
<block class="windows android" />
<block class="native windows android" />
![Android SDK Manager - 23.0.1 Build Tools](img/AndroidSDKManagerSDKToolsWindows.png)
<block class="windows mac linux android" />
<block class="native windows mac linux android" />
Finally, click "Apply" to download and install the Android SDK and related build tools.
<block class="mac android" />
<block class="native mac android" />
![Android SDK Manager - Installs](img/AndroidSDKManagerInstallsMacOS.png)
<block class="windows android" />
<block class="native windows android" />
![Android SDK Manager - Installs](img/AndroidSDKManagerInstallsWindows.png)
<block class="mac windows linux android" />
<block class="native mac windows linux android" />
#### 3. Set up the ANDROID_HOME environment variable
The React Native command line interface requires the `ANDROID_HOME` environment variable to be set up.
The React Native tools require some environment variables to be set up in order to build apps with native code.
<block class="mac android" />
<block class="native mac android" />
Add the following lines to your `~/.profile` (or equivalent) config file:
@ -311,7 +400,7 @@ Type `source ~/.profile` to load the config into your current shell.
> Please make sure you export the correct path for `ANDROID_HOME`. If you installed the Android SDK using Homebrew, it would be located at `/usr/local/opt/android-sdk`. You can find the actual location of the SDK in the Android Studio "Preferences" dialog, under **Appearance & Behavior****System Settings****Android SDK**.
<block class="linux android" />
<block class="native linux android" />
Add the following lines to your `~/.profile` (or equivalent) config file:
@ -321,21 +410,27 @@ export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
```
Type `source ~/.profile` to load the config into your current shell.
Type `. ~/.profile` to load the config into your current shell.
> Please make sure you export the correct path for `ANDROID_HOME` if you did not install the Android SDK using Android Studio. You can find the actual location of the SDK in the Android Studio "Preferences" dialog, under **Appearance & Behavior****System Settings****Android SDK**.
<block class="windows android" />
<block class="native windows android" />
Open the System pane under **System and Security** in the Control Panel, then click on **Change settings...**. Open the **Advanced** tab and click on **Environment Variables...**. Click on **New...** to create a new `ANDROID_HOME` user variable that points to the path to your Android SDK.
Open the System pane under **System and Security** in the Control Panel, then click on **Change settings...**. Open the **Advanced** tab and click on **Environment Variables...**. Click on **New...** to create a new `ANDROID_HOME` user variable that points to the path to your Android SDK:
![ANDROID_HOME Environment Variable](img/AndroidEnvironmentVariableANDROID_HOME.png)
The SDK is installed, by default, at the following location:
```
c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk
```
You can find the actual location of the SDK in the Android Studio "Preferences" dialog, under **Appearance & Behavior****System Settings****Android SDK**.
Open a new Command Prompt window to ensure the new environment variable is loaded.
Open a new Command Prompt window to ensure the new environment variable is loaded before proceeding to the next step.
<block class="linux android" />
<block class="native linux android" />
### Watchman (optional)
@ -344,43 +439,93 @@ Follow the [Watchman installation guide](https://facebook.github.io/watchman/doc
> [Watchman](https://facebook.github.io/watchman/docs/install.html) is a tool by Facebook for watching
changes in the filesystem. It is highly recommended you install it for better performance, but it's alright to skip this if you find the process to be tedious.
<block class="mac windows linux android" />
<block class="native mac ios" />
## Starting the Android Virtual Device
## Creating a new application
You can see the list of available AVDs by opening the "AVD Manager" from within Android Studio:
Use the React Native command line interface to generate a new React Native project called "AwesomeProject":
```
react-native init AwesomeProject
```
This is not necessary if you are integrating React Native into an existing application, if you "ejected" from Create React Native App, or if you're adding iOS support to an existing React Native project (see [Platform Specific Code](docs/platform-specific-code.html)).
<block class="native mac windows linux android" />
## Creating a new application
Use the React Native command line interface to generate a new React Native project called "AwesomeProject":
```
react-native init AwesomeProject
```
This is not necessary if you are integrating React Native into an existing application, if you "ejected" from Create React Native App, or if you're adding Android support to an existing React Native project (see [Platform Specific Code](docs/platform-specific-code.html)).
<block class="native mac windows linux android" />
## Preparing the Android device
You will need an Android device to run your React Native Android app. This can be either a physical Android device, or more commonly, you can use an Android Virtual Device which allows you to emulate an Android device on your computer.
Either way, you will need to prepare the device to run Android apps for development.
### Using a physical device
If you have a physical Android device, you can use it for development in place of an AVD by plugging it in to your computer using a USB cable and [enabling USB debugging](https://developer.android.com/training/basics/firstapp/running-app.html). You can then proceed to the next step.
### Using a virtual device
You can see the list of available Android Virtual Devices (AVDs) by opening the "AVD Manager" from within Android Studio. Look for an icon that looks like this:
![Android Studio AVD Manager](img/react-native-tools-avd.png)
<block class="windows linux android" />
If you have just installed Android Studio, you will likely need to [create a new AVD](https://developer.android.com/studio/run/managing-avds.html). Select "Create Virtual Device...", then pick any Phone from the list and click "Next".
Launch the default AVD before proceeding to the next step.
<block class="native windows android" />
<block class="mac android" />
![Android Studio AVD Manager](img/CreateAVDWindows.png)
Once in the "AVD Manager", select your AVD and click "Edit...". Choose "Android 6.0 - API Level 23" under Device, and "Intel Atom (x86_64)" under CPU/ABI. Click OK, then select your new AVD and click "Start...", and finally, "Launch".
<block class="native mac android" />
![Android AVD Configuration](img/AndroidAVDConfiguration.png)
![Android Studio AVD Manager](img/CreateAVDMacOS.png)
<block class="mac windows linux android" />
<block class="native mac windows linux android" />
> It is very common to run into an issue where Android Studio fails to create a default AVD. You may follow the [Android Studio User Guide](https://developer.android.com/studio/run/managing-avds.html) to create a new AVD manually if needed.
Select the "x86 Images" tab, then look for the **Marshmallow** API Level 23, x86_64 ABI image with a Android 6.0 (Google APIs) target.
### Using a real device
<block class="native linux android" />
If you have a physical Android device, you can use it for development in place of an AVD. Plug it in to your computer using a USB cable and [enable USB debugging](https://developer.android.com/training/basics/firstapp/running-app.html) before proceeding to the next step.
> We recommend configuring [VM acceleration](https://developer.android.com/studio/run/emulator-acceleration.html#vm-linux) on your system to improve performance. Once you've followed those instructions, go back to the AVD Manager.
<block class="mac ios android" />
<block class="native windows android" />
## Testing your React Native Installation
![Install HAXM](img/CreateAVDx86Windows.png)
<block class="mac ios" />
> If you don't have HAXM installed, click on "Install HAXM" or follow [these instructions](https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-windows) to set it up, then go back to the AVD Manager.
Use the React Native command line interface to generate a new React Native project called "AwesomeProject", then run `react-native run-ios` inside the newly created folder.
![AVD List](img/AVDManagerWindows.png)
<block class="native mac android" />
![Install HAXM](img/CreateAVDx86MacOS.png)
> If you don't have HAXM installed, follow [these instructions](https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-mac-os-x) to set it up, then go back to the AVD Manager.
![AVD List](img/AVDManagerMacOS.png)
<block class="native mac windows linux android" />
Click "Next" then "Finish" to create your AVD. At this point you should be able to click on the green triangle button next to your AVD to launch it, then proceed to the next step.
<block class="native mac ios" />
## Running your React Native application
Run `react-native run-ios` inside your React Native project folder:
```
# skip this first command if you ejected from Create React Native App
react-native init AwesomeProject
cd AwesomeProject
react-native run-ios
```
@ -391,40 +536,57 @@ You should see your new app running in the iOS Simulator shortly.
`react-native run-ios` is just one way to run your app. You can also run it directly from within Xcode or [Nuclide](https://nuclide.io/).
<block class="mac android" />
<block class="native mac windows linux android" />
Use the React Native command line interface to generate a new React Native project called "AwesomeProject", then run `react-native run-android` inside the newly created folder:
## Running your React Native application
Run `react-native run-android` inside your React Native project folder:
```
# skip this first command if you ejected from Create React Native App
react-native init AwesomeProject
cd AwesomeProject
react-native run-android
```
If everything is set up correctly, you should see your new app running in your Android emulator shortly.
<block class="native mac android" />
![AwesomeProject on Android](img/AndroidSuccessMacOS.png)
<block class="native windows android" />
![AwesomeProject on Android](img/AndroidSuccessWindows.png)
<block class="native mac windows linux android" />
`react-native run-android` is just one way to run your app - you can also run it directly from within Android Studio or [Nuclide](https://nuclide.io/).
<block class="mac ios android" />
<block class="native mac ios android" />
### Modifying your app
Now that you have successfully run the app, let's modify it.
<block class="mac ios" />
<block class="native mac ios" />
- Open `index.ios.js` in your text editor of choice and edit some lines.
- Hit `Command⌘ + R` in your iOS Simulator to reload the app and see your change!
- Hit `Command⌘ + R` in your iOS Simulator to reload the app and see your changes!
<block class="mac android" />
<block class="native mac android" />
- Open `index.android.js` in your text editor of choice and edit some lines.
- Press the `R` key twice or select `Reload` from the Developer Menu to see your change!
- Press the `R` key twice or select `Reload` from the Developer Menu to see your changes!
<block class="mac ios android" />
<block class="native windows linux android" />
### Modifying your app
Now that you have successfully run the app, let's modify it.
- Open `index.android.js` in your text editor of choice and edit some lines.
- Press the `R` key twice or select `Reload` from the Developer Menu to see your changes!
<block class="native mac ios android" />
### That's it!
@ -432,46 +594,7 @@ Congratulations! You've successfully run and modified your first React Native ap
<center><img src="img/react-native-congratulations.png" width="150"></img></center>
<block class="windows android" />
## Testing your React Native Installation
Use the React Native command line interface to generate a new React Native project called "AwesomeProject", then run `react-native run-android` inside the newly created folder:
```
# skip this first command if you ejected from Create React Native App
react-native init AwesomeProject
cd AwesomeProject
react-native run-android
```
<block class="linux android" />
## Testing your React Native Installation
Use the React Native command line interface to generate a new React Native project called "AwesomeProject", then run `react-native run-android` inside the newly created folder.
```
# skip this first command if you ejected from Create React Native App
react-native init AwesomeProject
cd AwesomeProject
react-native run-android
```
<block class="windows linux android" />
If everything is set up correctly, you should see your new app running in your Android emulator shortly.
![AwesomeProject on Android](img/AndroidSuccessWindows.png)
<block class="windows linux android" />
### Modifying your app
Now that you have successfully run the app, let's modify it.
- Open `index.android.js` in your text editor of choice and edit some lines.
- Press the `R` key twice or select `Reload` from the Developer Menu to see your change!
<block class="native windows linux android" />
### That's it!
@ -479,28 +602,29 @@ Congratulations! You've successfully run and modified a React Native app.
<center><img src="img/react-native-congratulations.png" width="150"></img></center>
<block class="mac ios" />
<block class="native mac ios" />
## Now What?
- If you want to add this new React Native code to an existing application, check out the [Integration guide](docs/integration-with-existing-apps.html).
- If you can't get this to work, see the [Troubleshooting](docs/troubleshooting.html#content) page.
- If you're curious to learn more about React Native, continue on
to the [Tutorial](docs/tutorial.html).
<block class="windows linux mac android" />
## Now What?
- If you can't get this to work, see the [Troubleshooting](docs/troubleshooting.html#content) page.
- If you want to add this new React Native code to an existing application, check out the [Integration guide](docs/integration-with-existing-apps.html).
- If you can't get this to work, see the [Troubleshooting](docs/troubleshooting.html#content) page.
<block class="native windows linux mac android" />
## Now What?
- If you're curious to learn more about React Native, continue on
to the [Tutorial](docs/tutorial.html).
- If you can't get this to work, see the [Troubleshooting](docs/troubleshooting.html#content) page.
- If you want to add this new React Native code to an existing application, check out the [Integration guide](docs/integration-with-existing-apps.html).
<script>
// Convert <div>...<span><block /></span>...</div>
// Into <div>...<block />...</div>
@ -562,6 +686,7 @@ if (window.location.hash !== '' && window.location.hash !== 'content') { // cont
break; // assume we don't have anything.
}
// We would have broken out if both targetPlatform and devOS hadn't been filled.
display('guide', 'native');
display('os', devOS);
display('platform', targetPlatform);
foundHash = true;
@ -576,6 +701,7 @@ if (window.location.hash !== '' && window.location.hash !== 'content') { // cont
if (!foundHash) {
var isMac = navigator.platform === 'MacIntel';
var isWindows = navigator.platform === 'Win32';
display('guide', 'quickstart');
display('os', isMac ? 'mac' : (isWindows ? 'windows' : 'linux'));
display('platform', isMac ? 'ios' : 'android');
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 KiB

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 KiB

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB