Updated docs for next

This commit is contained in:
Website Deployment Script
2016-09-19 20:46:10 +00:00
parent b6ac2f0b1e
commit 62ae207c86
4 changed files with 28 additions and 24 deletions
+27 -23
View File
@@ -49,48 +49,52 @@ block { display: none; }
</span><span><!-- ######### MAC for iOS ##################### -->
</span><span><block class="mac ios" />
</span><span><block class="mac ios android" />
</span><h2><a class="anchor" name="dependencies-for-mac-ios"></a>Dependencies for Mac + iOS <a class="hash-link" href="docs/getting-started.html#dependencies-for-mac-ios">#</a></h2><p>You will need Xcode, node.js, the React Native command line tools, and Watchman.</p><span><block class="mac android" />
</span><h2><a class="anchor" name="installing-dependencies"></a>Installing Dependencies <a class="hash-link" href="docs/getting-started.html#installing-dependencies">#</a></h2><span><block class="mac ios" />
</span><h2><a class="anchor" name="dependencies-for-mac-android"></a>Dependencies for Mac + Android <a class="hash-link" href="docs/getting-started.html#dependencies-for-mac-android">#</a></h2><p>You will need Android Studio, node.js, the React Native command line tools, and Watchman.</p><span><block class="mac ios android" />
</span><p>You will need Node.js, Watchman, the React Native command line interface, and Xcode.</p><span><block class="mac android" />
</span><p>We recommend installing node and watchman via <a href="http://brew.sh/" target="_blank">Homebrew</a>.</p><div class="prism language-javascript">brew install node
brew install watchman</div><p>Node comes with npm, which lets you install the React Native command line interface.</p><div class="prism language-javascript">npm install <span class="token operator">-</span>g react<span class="token operator">-</span>native<span class="token operator">-</span>cli</div><p>If you get a permission error, try with sudo: <code>sudo npm install -g react-native-cli</code>.</p><p>If you get error <code>Cannot find module &#x27;npmlog&#x27;</code>, try this before: <code>curl -0 -L http://npmjs.org/install.sh | sudo sh</code>.</p><span><block class="mac ios" />
</span><p>You will need Node.js, Watchman, the React Native command line interface, and Android Studio.</p><span><block class="mac ios android" />
</span><p>The easiest way to install Xcode is via the <a href="https://itunes.apple.com/us/app/xcode/id497799835?mt=12" target="_blank">Mac App Store</a>.</p><span><block class="mac android" />
</span><h3><a class="anchor" name="node-watchman"></a>Node, Watchman <a class="hash-link" href="docs/getting-started.html#node-watchman">#</a></h3><p>We recommend installing Node and Watchman using <a href="http://brew.sh/" target="_blank">Homebrew</a>. Run the following commands in a Terminal after installing Homebrew:</p><div class="prism language-javascript">brew install node
brew install watchman</div><blockquote><p><a href="https://facebook.github.io/watchman" target="_blank">Watchman</a> is a tool by Facebook for watching
changes in the filesystem. It is highly recommended you install it for better performance.</p></blockquote><h3><a class="anchor" name="the-react-native-cli"></a>The React Native CLI <a class="hash-link" href="docs/getting-started.html#the-react-native-cli">#</a></h3><p>Node.js comes with npm, which lets you install the React Native command line interface. Run the following command in a Terminal:</p><div class="prism language-javascript">npm install <span class="token operator">-</span>g react<span class="token operator">-</span>native<span class="token operator">-</span>cli</div><blockquote><p>If you get a <em>permission error</em>, try using sudo: <code>sudo npm install -g react-native-cli</code>.</p><p>If you get an error like <code>Cannot find module &#x27;npmlog&#x27;</code>, try installing npm directly: <code>curl -0 -L http://npmjs.org/install.sh | sudo sh</code>.</p></blockquote><span><block class="mac ios" />
</span><p>Download and install <a href="https://developer.android.com/studio/install.html" target="_blank">Android Studio</a>.</p><p>If you plan to make changes in Java code, we recommend <a href="https://docs.gradle.org/2.9/userguide/gradle_daemon.html" target="_blank">Gradle Daemon</a> which speeds up the build.</p><span><!-- ######### LINUX and WINDOWS for ANDROID ##################### -->
</span><h3><a class="anchor" name="xcode"></a>Xcode <a class="hash-link" href="docs/getting-started.html#xcode">#</a></h3><p>The easiest way to install Xcode is via the <a href="https://itunes.apple.com/us/app/xcode/id497799835?mt=12" target="_blank">Mac App Store</a>. Installing Xcode will also install the iOS Simulator and all the necessary tools to build your iOS app.</p><span><block class="mac android" />
</span><span><block class="linux android" />
</span><h3><a class="anchor" name="android-development-environment"></a>Android Development Environment <a class="hash-link" href="docs/getting-started.html#android-development-environment">#</a></h3><p>Setting up your development environment can be somewhat tedious if you&#x27;re new to Android development. If you&#x27;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.</p><h4><a class="anchor" name="1-install-android-studio"></a>1. Install Android Studio <a class="hash-link" href="docs/getting-started.html#1-install-android-studio">#</a></h4><p>Download and install <a href="https://developer.android.com/studio/install.html" target="_blank">Android Studio</a>.</p><h4><a class="anchor" name="2-confirm-the-android-sdk-is-installed"></a>2. Confirm the Android SDK is installed <a class="hash-link" href="docs/getting-started.html#2-confirm-the-android-sdk-is-installed">#</a></h4><p>Android Studio installs <code>Android 7.0 (Nougat)</code> by default. You can confirm that the SDK was installed by clicking on &quot;Configure&quot; in the last screen in the Android Studio Setup Wizard, or by opening &quot;Preferences&quot; from the Android Studio menu, then choosing <code>Appearance and Behavior</code><code>System Settings</code><code>Android SDK</code>.</p><p><img src="img/react-native-android-studio-configure-sdk.png" alt="Android Studio SDK Manager"></p><p>Select &quot;SDK Platforms&quot; from within the SDK Manager and you should see a blue checkmark next to &quot;Android 7.0 (Nougat)&quot;. In case it is not, click on the checkbox and then &quot;Apply&quot;.</p><p><img src="img/react-native-sdk-platforms.png" alt="Android Studio SDK Manager"></p><blockquote><p>If you wish to support older versions of Android, you can install additional Android SDKs from this screen.</p></blockquote><h4><a class="anchor" name="3-set-up-paths"></a>3. Set up paths <a class="hash-link" href="docs/getting-started.html#3-set-up-paths">#</a></h4><p>The React Native command line interface requires the <code>ANDROID_HOME</code> environment variable to be set up. You can configure it in a Terminal using the following command:</p><div class="prism language-javascript">export ANDROID_HOME<span class="token operator">=</span><span class="token operator">~</span><span class="token operator">/</span>Library<span class="token operator">/</span>Android<span class="token operator">/</span>sdk</div><p>To avoid doing this every time you open a new Terminal, create (or edit) <code>~/.bashrc</code> using your favorite text editor and add the following lines:</p><div class="prism language-javascript">export ANDROID_HOME<span class="token operator">=</span><span class="token operator">~</span><span class="token operator">/</span>Library<span class="token operator">/</span>Android<span class="token operator">/</span>sdk
export PATH<span class="token operator">=</span>$<span class="token punctuation">{</span>PATH<span class="token punctuation">}</span><span class="token punctuation">:</span>$<span class="token punctuation">{</span>ANDROID_HOME<span class="token punctuation">}</span><span class="token operator">/</span>tools</div><p>The second line will add the <code>android</code> tool to your path, which will come in handy in the next step.</p><blockquote><p>Please make sure you export the correct path for <code>ANDROID_HOME</code> if you did not install the Android SDK using Android Studio. If you install the Android SDK using Homebrew, it will be located at <code>/usr/local/opt/android-sdk</code>.</p></blockquote><h4><a class="anchor" name="4-set-up-your-android-virtual-device"></a>4. Set up your Android Virtual Device <a class="hash-link" href="docs/getting-started.html#4-set-up-your-android-virtual-device">#</a></h4><p>Android Studio should have set up an Android Virtual Device for you during installation, but it is very common to run into an issue where Android Studio fails to install the AVD.</p><p><img src="img/react-native-tools-avd.png" alt="Android Studio AVD Manager"></p><p>To see the list of available AVDs, launch the &quot;AVD Manager&quot; from within Android Studio or run the following command in a Terminal:</p><div class="prism language-javascript">android avd</div><p>You may follow the <a href="https://developer.android.com/studio/run/managing-avds.html" target="_blank">Android Studio User Guide</a> to create a new AVD if needed.</p><blockquote><p>If you see &quot;No system images installed for this target.&quot; under CPU/ABI, go back to your &quot;SDK Manager&quot; and click on &quot;Show Package Details&quot; under &quot;SDK Platforms&quot;. You will then be able to install any missing system images, such as &quot;Google APIs Intel Atom (x86)&quot;.</p></blockquote><span><!-- ######### LINUX and WINDOWS for ANDROID ##################### -->
</span><h2><a class="anchor" name="dependencies-for-linux-android"></a>Dependencies for Linux + Android <a class="hash-link" href="docs/getting-started.html#dependencies-for-linux-android">#</a></h2><span><block class="windows android" />
</span><span><block class="windows linux android" />
</span><h2><a class="anchor" name="dependencies-for-windows-android"></a>Dependencies for Windows + Android <a class="hash-link" href="docs/getting-started.html#dependencies-for-windows-android">#</a></h2><span><block class="linux windows android" />
</span><h2><a class="anchor" name="installing-dependencies"></a>Installing Dependencies <a class="hash-link" href="docs/getting-started.html#installing-dependencies">#</a></h2><span><block class="linux android" />
</span><p>You will need node.js, the React Native command line tools, Watchman, and Android Studio.</p><span><block class="linux android" />
</span><p>You will need Node.js, the React Native command line interface, and Android Studio.</p><h3><a class="anchor" name="node"></a>Node <a class="hash-link" href="docs/getting-started.html#node">#</a></h3><p>Follow the <a href="https://nodejs.org/en/download/package-manager/" target="_blank">installation instructions for your Linux distribution</a> to install Node.js 4 or newer.</p><span><block class='windows android' />
</span><p>Follow the <a href="https://nodejs.org/en/download/package-manager/" target="_blank">installation instructions for your Linux distribution</a> to install Node.js 4 or newer.</p><span><block class='windows android' />
</span><p>You will need Node.js, the React Native command line interface, and Android Studio.</p><h3><a class="anchor" name="node"></a>Node <a class="hash-link" href="docs/getting-started.html#node">#</a></h3><p>We recommend installing Node.js and Python2 via <a href="https://chocolatey.org" target="_blank">Chocolatey</a>, a popular package manager for Windows. Open a Command Prompt as Administrator, then run:</p><div class="prism language-javascript">choco install nodejs<span class="token punctuation">.</span>install
choco install python2</div><blockquote><p>You can find additional installation options on <a href="https://nodejs.org/en/download/" target="_blank">Node.js&#x27;s Downloads page</a>.</p></blockquote><span><block class="windows linux android" />
</span><p>We recommend installing node.js and Python2 via <a href="https://chocolatey.org" target="_blank">Chocolatey</a>, a popular package manager for Windows. Open a Command Prompt as Administrator, then run:</p><div class="prism language-javascript">choco install nodejs<span class="token punctuation">.</span>install
choco install python2</div><span><block class="windows linux android" />
</span><h3><a class="anchor" name="the-react-native-cli"></a>The React Native CLI <a class="hash-link" href="docs/getting-started.html#the-react-native-cli">#</a></h3><p>Node comes with npm, which lets you install the React Native command line interface.</p><div class="prism language-javascript">npm install <span class="token operator">-</span>g react<span class="token operator">-</span>native<span class="token operator">-</span>cli</div><h3><a class="anchor" name="android-development-environment"></a>Android Development Environment <a class="hash-link" href="docs/getting-started.html#android-development-environment">#</a></h3><p>Setting up your development environment can be somewhat tedious if you&#x27;re new to Android development. If you&#x27;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.</p><h4><a class="anchor" name="1-install-android-studio"></a>1. Install Android Studio <a class="hash-link" href="docs/getting-started.html#1-install-android-studio">#</a></h4><p>Download and install <a href="https://developer.android.com/studio/install.html" target="_blank">Android Studio</a>.</p><h4><a class="anchor" name="2-confirm-the-android-sdk-is-installed"></a>2. Confirm the Android SDK is installed <a class="hash-link" href="docs/getting-started.html#2-confirm-the-android-sdk-is-installed">#</a></h4><p>Android Studio installs <code>Android 7.0 (Nougat)</code> by default. You can confirm that the SDK was installed by clicking on &quot;Configure&quot; in the last screen in the Android Studio Setup Wizard, or by opening &quot;Preferences&quot; from the Android Studio menu, then choosing <code>Appearance and Behavior</code><code>System Settings</code><code>Android SDK</code>.</p><p><img src="img/react-native-android-studio-configure-sdk-windows.png" alt="Android Studio SDK Manager"></p><p>Select &quot;SDK Platforms&quot; from within the SDK Manager and you should see a blue checkmark next to &quot;Android 7.0 (Nougat)&quot;. In case it is not, click on the checkbox and then &quot;Apply&quot;.</p><p><img src="img/react-native-sdk-platforms.png" alt="Android Studio SDK Manager"></p><blockquote><p>If you wish to support older versions of Android, you can install additional Android SDKs from this screen.</p></blockquote><h4><a class="anchor" name="3-set-up-paths"></a>3. Set up paths <a class="hash-link" href="docs/getting-started.html#3-set-up-paths">#</a></h4><p>The React Native command line interface requires the <code>ANDROID_HOME</code> environment variable to be set up.</p><span><block class="linux android" />
</span><p>Node comes with npm, which lets you install the React Native command line interface.</p><div class="prism language-javascript">npm install <span class="token operator">-</span>g react<span class="token operator">-</span>native<span class="token operator">-</span>cli</div><span><block class="windows linux android" />
</span><p>Create or edit your <code>~/.bashrc</code> file and add the following lines:</p><div class="prism language-javascript">export ANDROID_HOME<span class="token operator">=</span><span class="token operator">~</span><span class="token operator">/</span>Android<span class="token operator">/</span>Sdk
export PATH<span class="token operator">=</span>$<span class="token punctuation">{</span>PATH<span class="token punctuation">}</span><span class="token punctuation">:</span>$<span class="token punctuation">{</span>ANDROID_HOME<span class="token punctuation">}</span><span class="token operator">/</span>tools</div><p>The second line will add the <code>android</code> tool to your path, which will come in handy in the next step.</p><blockquote><p>Please make sure you export the correct path for <code>ANDROID_HOME</code> if you did not install the Android SDK using Android Studio.</p></blockquote><span><block class="windows android" />
</span><p>Download and install <a href="https://developer.android.com/studio/install.html" target="_blank">Android Studio</a>.</p><span><block class="linux android" />
</span><p>Go to <code>Control Panel</code><code>System and Security</code><code>System</code><code>Change settings</code>
<code>Advanced System Settings</code><code>Environment variables</code><code>New</code>, then enter the path to your Android SDK.</p><p><img src="img/react-native-android-sdk-environment-variable-windows.png" alt="env variable"></p><blockquote><p>Please make sure you use the correct path for <code>ANDROID_HOME</code> if you did not install the Android SDK using Android Studio.</p></blockquote><p>Restart the Command Prompt to apply the new environment variable.</p><span><block class="linux windows android" />
</span><p><a href="https://facebook.github.io/watchman" target="_blank">Watchman</a> is a tool by Facebook for watching changes in the filesystem. Installing it should
improve performance, but you can also try not installing it, if the installation process is too annoying. You can follow the <a href="https://facebook.github.io/watchman/docs/install.html#installing-from-source" target="_blank">Watchman installation guide</a> to compile and install from source.</p><span><block class="windows linux android" />
</span><h4><a class="anchor" name="4-set-up-your-android-virtual-device"></a>4. Set up your Android Virtual Device <a class="hash-link" href="docs/getting-started.html#4-set-up-your-android-virtual-device">#</a></h4><p>Android Studio should have set up an Android Virtual Device for you during installation, but it is very common to run into an issue where Android Studio fails to install the AVD.</p><p><img src="img/react-native-tools-avd.png" alt="Android Studio AVD Manager"></p><p>To see the list of available AVDs, launch the &quot;AVD Manager&quot; from within Android Studio or run the following command in a terminal:</p><div class="prism language-javascript">android avd</div><p>You may follow the <a href="https://developer.android.com/studio/run/managing-avds.html" target="_blank">Android Studio User Guide</a> to create a new AVD if needed.</p><blockquote><p>If you see &quot;No system images installed for this target.&quot; under CPU/ABI, go back to your &quot;SDK Manager&quot; and click on &quot;Show Package Details&quot; under &quot;SDK Platforms&quot;. You will then be able to install any missing system images, such as &quot;Google APIs Intel Atom (x86)&quot;.</p></blockquote><span><block class="linux android" />
</span><p>If you plan to make changes in Java code, we recommend <a href="https://docs.gradle.org/2.9/userguide/gradle_daemon.html" target="_blank">Gradle Daemon</a> which speeds up the build.</p><span><block class="mac ios android" />
</span><h3><a class="anchor" name="watchman-optional"></a>Watchman (optional) <a class="hash-link" href="docs/getting-started.html#watchman-optional">#</a></h3><p>Follow the <a href="https://facebook.github.io/watchman/docs/install.html#build-install" target="_blank">Watchman installation guide</a> to compile and install Watchman from source.</p><blockquote><p><a href="https://facebook.github.io/watchman/docs/install.html" target="_blank">Watchman</a> is a tool by Facebook for watching
changes in the filesystem. It is highly recommended you install it for better performance, but it&#x27;s alright to skip this if you find the process to be tedious.</p></blockquote><span><block class="mac ios android" />
</span><h2><a class="anchor" name="testing-your-react-native-installation"></a>Testing your React Native Installation <a class="hash-link" href="docs/getting-started.html#testing-your-react-native-installation">#</a></h2><span><block class="mac ios" />
</span><p>Use the React Native command line tools to generate a new React Native project called &quot;AwesomeProject&quot;, then run <code>react-native run-ios</code> inside the newly created folder.</p><div class="prism language-javascript">react<span class="token operator">-</span>native init AwesomeProject
</span><p>Use the React Native command line interface to generate a new React Native project called &quot;AwesomeProject&quot;, then run <code>react-native run-ios</code> inside the newly created folder.</p><div class="prism language-javascript">react<span class="token operator">-</span>native init AwesomeProject
cd AwesomeProject
react<span class="token operator">-</span>native run<span class="token operator">-</span>ios</div><p>You should see your new app running in the iOS Simulator shortly. <code>react-native run-ios</code> is just one way to run your app - you can also run it directly from within Xcode or Nuclide.</p><span><block class="mac android" />
react<span class="token operator">-</span>native run<span class="token operator">-</span>ios</div><p>You should see your new app running in the iOS Simulator shortly.</p><p><code>react-native run-ios</code> is just one way to run your app. You can also run it directly from within Xcode or Nuclide.</p><span><block class="mac android" />
</span><p>Use the React Native command line tools to generate a new React Native project called &quot;AwesomeProject&quot;, then run <code>react-native run-android</code> inside the newly created folder.</p><div class="prism language-javascript">react<span class="token operator">-</span>native init AwesomeProject
</span><p>Use the React Native command line interface to generate a new React Native project called &quot;AwesomeProject&quot;, then run <code>react-native run-android</code> inside the newly created folder.</p><div class="prism language-javascript">react<span class="token operator">-</span>native init AwesomeProject
cd AwesomeProject
react<span class="token operator">-</span>native run<span class="token operator">-</span>android</div><p>If everything is set up correctly, you should see your new app running in your Android emulator shortly. <code>react-native run-android</code> is just one way to run your app - you can also run it directly from within Android Studio or Nuclide.</p><span><block class="mac ios android" />
@@ -104,7 +108,7 @@ react<span class="token operator">-</span>native run<span class="token operator"
</span><span><block class="windows linux android" />
</span><h2><a class="anchor" name="testing-your-react-native-installation"></a>Testing your React Native Installation <a class="hash-link" href="docs/getting-started.html#testing-your-react-native-installation">#</a></h2><p>Use the React Native command line tools to generate a new React Native project called &quot;AwesomeProject&quot;, then run <code>react-native run-android</code> inside the newly created folder.</p><div class="prism language-javascript">react<span class="token operator">-</span>native init AwesomeProject
</span><h2><a class="anchor" name="testing-your-react-native-installation"></a>Testing your React Native Installation <a class="hash-link" href="docs/getting-started.html#testing-your-react-native-installation">#</a></h2><p>Use the React Native command line interface to generate a new React Native project called &quot;AwesomeProject&quot;, then run <code>react-native run-android</code> inside the newly created folder.</p><div class="prism language-javascript">react<span class="token operator">-</span>native init AwesomeProject
cd AwesomeProject
react<span class="token operator">-</span>native run<span class="token operator">-</span>android</div><p>If everything is set up correctly, you should see your new app running in your Android emulator shortly.</p><blockquote><p>A common issue is that the packager is not started automatically when you run
<code>react-native run-android</code>. You can start it manually using <code>react-native start</code>.</p></blockquote><span><block class="windows android" />
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB