Files
react-native/docs/environment-setup.html
T
2021-03-12 23:34:56 +00:00

54 lines
109 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-alpha.70">
<link rel="alternate" type="application/rss+xml" href="/blog/rss.xml" title="React Native Blog RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/blog/atom.xml" title="React Native Blog Atom Feed">
<link rel="preconnect" href="https://www.google-analytics.com">
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-41298772-2","auto"),ga("send","pageview")</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
<link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-41298772-2"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-41298772-2",{})</script>
<link rel="search" type="application/opensearchdescription+xml" title="React Native" href="/opensearch.xml">
<link rel="icon" href="/img/pwa/manifest-icon-512.png">
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#20232a">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#20232a">
<link rel="apple-touch-icon" href="/img/pwa/manifest-icon-512.png">
<link rel="mask-icon" href="/img/pwa/manifest-icon-512.png" color="#06bcee">
<meta name="msapplication-TileImage" href="/img/pwa/manifest-icon-512.png">
<meta name="msapplication-TileColor" content="#20232a">
<script src="https://cdn.jsdelivr.net/npm/focus-visible@5.2.0/dist/focus-visible.min.js" defer="defer"></script>
<script src="https://snack.expo.io/embed.js" defer="defer"></script><title data-react-helmet="true">Setting up the development environment · React Native</title><meta data-react-helmet="true" name="twitter:image:alt" content="Image for React Native"><meta data-react-helmet="true" name="docsearch:language" content="en"><meta data-react-helmet="true" name="docsearch:version" content="0.64"><meta data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-0.64"><meta data-react-helmet="true" property="og:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" name="twitter:card" content="summary"><meta data-react-helmet="true" name="twitter:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" property="og:title" content="Setting up the development environment · React Native"><meta data-react-helmet="true" name="description" content="This page will help you install and build your first React Native app."><meta data-react-helmet="true" property="og:description" content="This page will help you install and build your first React Native app."><meta data-react-helmet="true" property="og:url" content="https://reactnative.dev/docs/environment-setup"><link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.ico"><link data-react-helmet="true" rel="preconnect" href="https://BH4D9OD16A-dsn.algolia.net" crossorigin="anonymous"><link data-react-helmet="true" rel="canonical" href="https://reactnative.dev/docs/environment-setup"><link rel="stylesheet" href="/styles.f56da522.css">
<link rel="stylesheet" href="/main.3de2b5ef.css">
<link rel="preload" href="/styles.9d29dd5a.js" as="script">
<link rel="preload" href="/runtime~main.acc4c949.js" as="script">
<link rel="preload" href="/main.337c3f7c.js" as="script">
<link rel="preload" href="/1.7a6193e2.js" as="script">
<link rel="preload" href="/2.9b40dc51.js" as="script">
<link rel="preload" href="/1089.caa7a648.js" as="script">
<link rel="preload" href="/1f03ab5e.a02daabd.js" as="script">
<link rel="preload" href="/17896441.b54b3e3c.js" as="script">
<link rel="preload" href="/a2bc933b.926bd470.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<nav aria-label="Skip navigation links"><button type="button" tabindex="0" class="skipToContent_3aLp">Skip to main content</button></nav><nav class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><div aria-label="Navigation bar toggle" class="navbar__toggle" role="button" tabindex="0"><svg aria-label="Menu" width="30" height="30" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></div><a class="navbar__brand" href="/"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--light_VJaY navbar__logo"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--dark_1NF3 navbar__logo"><strong class="navbar__title">React Native</strong></a><div class="navbar__item dropdown dropdown--hoverable dropdown--left"><a class="navbar__item navbar__link" href="/docs/getting-started">0.64</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/docs/next/environment-setup">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/docs/environment-setup">0.64</a></li><li><a class="dropdown__link" href="/docs/0.63/environment-setup">0.63</a></li><li><a class="dropdown__link" href="/docs/0.62/environment-setup">0.62</a></li><li><a class="dropdown__link" href="/docs/0.61/getting-started">0.61</a></li><li><a class="dropdown__link" href="/docs/0.60/getting-started">0.60</a></li><li><a class="dropdown__link" href="/versions">All versions</a></li></ul></div></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link navbar__link--active" href="/docs/getting-started">Docs</a><a class="navbar__item navbar__link" href="/docs/components-and-apis">Components</a><a class="navbar__item navbar__link" href="/docs/accessibilityinfo">API</a><a class="navbar__item navbar__link" href="/help">Community</a><a class="navbar__item navbar__link" href="/blog">Blog</a><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link navbar-github-link" aria-label="GitHub repository"></a><div class="react-toggle react-toggle--disabled displayOnlyInLargeViewport_Bh6k"><div class="react-toggle-track"><div class="react-toggle-track-check"><span class="toggle_1UDy">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_1UDy">🌞</span></div></div><div class="react-toggle-thumb"></div><input type="checkbox" disabled="" aria-label="Dark mode toggle" class="react-toggle-screenreader-only"></div><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span></button></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--light_VJaY navbar__logo"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--dark_1NF3 navbar__logo"><strong class="navbar__title">React Native</strong></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a class="menu__link navbar__link--active" href="/docs/getting-started">Docs</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/components-and-apis">Components</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/accessibilityinfo">API</a></li><li class="menu__list-item"><a class="menu__link" href="/help">Community</a></li><li class="menu__list-item"><a class="menu__link" href="/blog">Blog</a></li><li class="menu__list-item"><a role="button" class="menu__link menu__link--sublist">Versions</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/next/environment-setup">Next</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active" href="/docs/environment-setup">0.64</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.63/environment-setup">0.63</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.62/environment-setup">0.62</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.61/getting-started">0.61</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.60/getting-started">0.60</a></li><li class="menu__list-item"><a class="menu__link" href="/versions">All versions</a></li></ul></li><li class="menu__list-item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="menu__link navbar-github-link" aria-label="GitHub repository"></a></li></ul></div></div></div></nav><div class="main-wrapper"><div class="docPage_1mVJ"><div class="docSidebarContainer_uPTz" role="complementary"><div class="sidebar_M-Lc"><div class="menu menu--responsive thin-scrollbar menu_tgpy"><button aria-label="Open Menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg aria-label="Menu" class="sidebarMenuIcon_1e05" width="24" height="24" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">The Basics</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/getting-started">Introduction</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/intro-react-native-components">Core Components and Native Components</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/intro-react">React Fundamentals</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/handling-text-input">Handling Text Input</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/using-a-scrollview">Using a ScrollView</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/using-a-listview">Using List Views</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/troubleshooting">Troubleshooting</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/platform-specific-code">Platform Specific Code</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/more-resources">More Resources</a></li></ul></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">Environment setup</a><ul class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" tabindex="0" href="/docs/environment-setup">Setting up the development environment</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/integration-with-existing-apps">Integration with Existing Apps</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/integration-with-android-fragment">Integration with an Android Fragment</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/building-for-tv">Building For TV Devices</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/out-of-tree-platforms">Out-of-Tree Platforms</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Workflow</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/running-on-device">Running On Device</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/fast-refresh">Fast Refresh</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/debugging">Debugging</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/symbolication">Symbolicating a stack trace</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/testing-overview">Testing</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/libraries">Using Libraries</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/typescript">Using TypeScript</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/upgrading">Upgrading to new versions</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Design</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/style">Style</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/height-and-width">Height and Width</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/flexbox">Layout with Flexbox</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/images">Images</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/colors">Color Reference</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Interaction</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/handling-touches">Handling Touches</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/navigation">Navigating Between Screens</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/animations">Animations</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/gesture-responder-system">Gesture Responder System</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Inclusion</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/accessibility">Accessibility</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Performance</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/performance">Performance Overview</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/optimizing-flatlist-configuration">Optimizing Flatlist Configuration</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/ram-bundles-inline-requires">RAM Bundles and Inline Requires</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/profiling">Profiling</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/profile-hermes">Profiling with Hermes</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">JavaScript Runtime</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/javascript-environment">JavaScript Environment</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/timers">Timers</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/hermes">Using Hermes</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Connectivity</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/network">Networking</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/security">Security</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Native Modules</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/native-modules-intro">Native Modules Intro</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/native-modules-android">Android Native Modules</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/native-modules-ios">iOS Native Modules</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/native-modules-setup">Native Modules NPM Package Setup</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Native Components</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/native-components-android">Android Native UI Components</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/native-components-ios">iOS Native UI Components</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/direct-manipulation">Direct Manipulation</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Guides (Android)</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/headless-js-android">Headless JS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/signed-apk-android">Publishing to Google Play Store</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Guides (iOS)</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/linking-libraries-ios">Linking Libraries</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/running-on-simulator-ios">Running On Simulator</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/communication-ios">Communication between native and React Native</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/app-extensions">App Extensions</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/publishing-to-app-store">Publishing to Apple App Store</a></li></ul></li></ul></div></div></div><main class="docMainContainer_1zi2"><div class="container padding-vert--lg docItemWrapper_1hMI"><div class="row"><div class="col"><div class="docItemContainer_1tAC"><article><header><h1 class="docTitle_cWlf">Setting up the development environment</h1></header><div class="markdown"><p>This page will help you install and build your first React Native app.</p><p><strong>If you are new to mobile development</strong>, the easiest way to get started is with Expo CLI. Expo is a set of tools built around React Native and, while it has many <a href="https://expo.io/features" target="_blank" rel="noopener noreferrer">features</a>, the most relevant feature for us right now is that it can get you writing a React Native app within minutes. You will only need a recent version of Node.js and a phone or emulator. If you&#x27;d like to try out React Native directly in your web browser before installing any tools, you can try out <a href="https://snack.expo.io/" target="_blank" rel="noopener noreferrer">Snack</a>.</p><p><strong>If you are already familiar with mobile development</strong>, you may want to use React Native CLI. It requires Xcode or Android Studio to get started. If you already have one of these tools installed, you should be able to get up and running within a few minutes. If they are not installed, you should expect to spend about an hour installing and configuring them.</p><div><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_2uuE tabs__item--active">Expo CLI Quickstart</li><li role="tab" tabindex="0" aria-selected="false" class="tabs__item tabItem_2uuE">React Native CLI Quickstart</li></ul><div class="margin-vert--md"><div role="tabpanel"><p>Assuming that you have <a href="https://nodejs.org/en/download/" target="_blank" rel="noopener noreferrer">Node 12 LTS</a> or greater installed, you can use npm to install the Expo CLI command line utility:</p><div><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_2uuE tabs__item--active">npm</li><li role="tab" tabindex="0" aria-selected="false" class="tabs__item tabItem_2uuE">Yarn</li></ul><div class="margin-vert--md"><div role="tabpanel"><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">npm</span><span class="token plain"> </span><span class="token function" style="color:#79b6f2">install</span><span class="token plain"> -g expo-cli</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div></div><div role="tabpanel" hidden=""><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">yarn</span><span class="token plain"> global </span><span class="token function" style="color:#79b6f2">add</span><span class="token plain"> expo-cli</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div></div></div></div><p>Then run the following commands to create a new React Native project called &quot;AwesomeProject&quot;:</p><div><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_2uuE tabs__item--active">npm</li><li role="tab" tabindex="0" aria-selected="false" class="tabs__item tabItem_2uuE">Yarn</li></ul><div class="margin-vert--md"><div role="tabpanel"><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">expo init AwesomeProject</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">cd</span><span class="token plain"> AwesomeProject</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token function" style="color:#79b6f2">npm</span><span class="token plain"> start </span><span class="token comment" style="color:#93a1a1"># you can also use: expo start</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div></div><div role="tabpanel" hidden=""><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">expo init AwesomeProject</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain" style="display:inline-block">
</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">cd</span><span class="token plain"> AwesomeProject</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token function" style="color:#79b6f2">yarn</span><span class="token plain"> start </span><span class="token comment" style="color:#93a1a1"># you can also use: expo start</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div></div></div></div><p>This will start a development server for you.</p><h2>Running your React Native application</h2><p>Install the <a href="https://expo.io" target="_blank" rel="noopener noreferrer">Expo</a> client app on your iOS or Android phone and connect to the same wireless network as your computer. On Android, use the Expo app to scan the QR code from your terminal to open your project. On iOS, use the built-in QR code scanner of the Camera app.</p><h3>Modifying your app</h3><p>Now that you have successfully run the app, let&#x27;s modify it. Open <code>App.js</code> in your text editor of choice and edit some lines. The application should reload automatically once you save your changes.</p><h3>That&#x27;s it!</h3><p>Congratulations! You&#x27;ve successfully run and modified your first React Native app.</p><center><img src="/docs/assets/GettingStartedCongratulations.png" width="150"></center><h2>Now what?</h2><p>Expo also has <a href="https://docs.expo.io" target="_blank" rel="noopener noreferrer">docs</a> you can reference if you have questions specific to the tool. You can also ask for help at <a href="https://forums.expo.io" target="_blank" rel="noopener noreferrer">Expo forums</a>.</p><p>These tools help you get started quickly, but before committing to building your app with Expo CLI, <a href="https://docs.expo.io/versions/latest/introduction/why-not-expo/" target="_blank" rel="noopener noreferrer">read about the limitations</a>.</p><p>If you have a problem with Expo, before creating a new issue, please see if there&#x27;s an existing issue about it:</p><ul><li>in the <a href="https://github.com/expo/expo-cli/issues" target="_blank" rel="noopener noreferrer">Expo CLI issues</a> (for issues related to Expo CLI), or</li><li>in the <a href="https://github.com/expo/expo/issues" target="_blank" rel="noopener noreferrer">Expo issues</a> (for issues about the Expo client or SDK).</li></ul><p>If you&#x27;re curious to learn more about React Native, check out the <a href="/docs/getting-started">Introduction to React Native</a>.</p><h3>Running your app on a simulator or virtual device</h3><p>Expo CLI allows you to run your React Native app on a physical device without setting up a development environment. If you want to run your app on the iOS Simulator or an Android Virtual Device, please refer to the instructions for &quot;React Native CLI Quickstart&quot; to learn how to install Xcode or set up your Android development environment.</p><p>Once you&#x27;ve set these up, you can launch your app on an Android Virtual Device by running <code>npm run android</code>, or on the iOS Simulator by running <code>npm run ios</code> (macOS only).</p><h3>Caveats</h3><p>Because you don&#x27;t build any native code when using Expo to create a project, it&#x27;s not possible to include custom native modules beyond the React Native APIs and components that are available in the Expo client app.</p><p>If you know that you&#x27;ll eventually need to include your own native code, Expo is still a good way to get started. In that case you&#x27;ll need to &quot;<a href="https://docs.expo.io/versions/latest/workflow/customizing/" target="_blank" rel="noopener noreferrer">eject</a>&quot; eventually to create your own native builds. If you do eject, the &quot;React Native CLI Quickstart&quot; instructions will be required to continue working on your project.</p><p>Expo CLI configures your project to use the most recent React Native version that is supported by the Expo client app. The Expo client app usually gains support for a given React Native version about a week after the React Native version is released as stable. You can check <a href="https://docs.expo.io/versions/latest/sdk/overview/#sdk-version" target="_blank" rel="noopener noreferrer">this document</a> to find out what versions are supported.</p><p>If you&#x27;re integrating React Native into an existing project, you&#x27;ll want to skip Expo CLI and go directly to setting up the native build environment. Select &quot;React Native CLI Quickstart&quot; above for instructions on configuring a native build environment for React Native.</p></div><div role="tabpanel" hidden=""><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 &quot;ejected&quot; from Expo, you&#x27;ll need this section.</p><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 Android and iOS, that&#x27;s fine - you can pick one to start with, since the setup is a bit different.</p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="development-os"></a>Development OS<a class="hash-link" href="#development-os" title="Direct link to heading">#</a></h4><div><ul role="tablist" aria-orientation="horizontal" class="tabs pill-tabs"><li role="tab" tabindex="0" aria-selected="false" class="tabs__item tabItem_2uuE">macOS</li><li role="tab" tabindex="0" aria-selected="false" class="tabs__item tabItem_2uuE">Windows</li><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_2uuE tabs__item--active">Linux</li></ul><div class="margin-vert--md"><div role="tabpanel" hidden=""><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="target-os"></a>Target OS<a class="hash-link" href="#target-os" title="Direct link to heading">#</a></h4><div><ul role="tablist" aria-orientation="horizontal" class="tabs pill-tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_2uuE tabs__item--active">Android</li><li role="tab" tabindex="0" aria-selected="false" class="tabs__item tabItem_2uuE">iOS</li></ul><div class="margin-vert--md"><div role="tabpanel"><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="installing-dependencies"></a>Installing dependencies<a class="hash-link" href="#installing-dependencies" title="Direct link to heading">#</a></h2><p>You will need Node, Watchman, the React Native command line interface, a JDK, and Android Studio.</p><p>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.</p><h3>Node &amp; Watchman</h3><p>We recommend installing Node and Watchman using <a href="http://brew.sh/" target="_blank" rel="noopener noreferrer">Homebrew</a>. Run the following commands in a Terminal after installing Homebrew:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">brew </span><span class="token function" style="color:#79b6f2">install</span><span class="token plain"> node</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">brew </span><span class="token function" style="color:#79b6f2">install</span><span class="token plain"> watchman</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>If you have already installed Node on your system, make sure it is Node 12 or newer.</p><p><a href="https://facebook.github.io/watchman" target="_blank" rel="noopener noreferrer">Watchman</a> is a tool by Facebook for watching changes in the filesystem. It is highly recommended you install it for better performance.</p><h3>Java Development Kit</h3><p>We recommend installing JDK using <a href="http://brew.sh/" target="_blank" rel="noopener noreferrer">Homebrew</a>. Run the following commands in a Terminal after installing Homebrew:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">brew </span><span class="token function" style="color:#79b6f2">install</span><span class="token plain"> --cask adoptopenjdk/openjdk/adoptopenjdk8</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>If you have already installed JDK on your system, make sure it is JDK 8 or newer.</p><h3>Android development environment</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>1. Install Android Studio</h4><p><a href="https://developer.android.com/studio/index.html" target="_blank" rel="noopener noreferrer">Download and install Android Studio</a>. While on Android Studio installation wizard, make sure the boxes next to all of the following items are checked:</p><ul><li><code>Android SDK</code></li><li><code>Android SDK Platform</code></li><li><code>Android Virtual Device</code></li></ul><p>Then, click &quot;Next&quot; to install all of these components.</p><blockquote><p>If the checkboxes are grayed out, you will have a chance to install these components later on.</p></blockquote><p>Once setup has finalized and you&#x27;re presented with the Welcome screen, proceed to the next step.</p><h4>2. Install the Android SDK</h4><p>Android Studio installs the latest Android SDK by default. Building a React Native app with native code, however, requires the <code>Android 10 (Q)</code> SDK in particular. Additional Android SDKs can be installed through the SDK Manager in Android Studio.</p><p>To do that, open Android Studio, click on &quot;Configure&quot; button and select &quot;SDK Manager&quot;.</p><p><img alt="Android Studio Welcome" src="/assets/images/GettingStartedAndroidStudioWelcomeMacOS-cbb28b4b70c4158c1afd02ddb6b12f4a.png"></p><blockquote><p>The SDK Manager can also be found within the Android Studio &quot;Preferences&quot; dialog, under <strong>Appearance &amp; Behavior</strong><strong>System Settings</strong><strong>Android SDK</strong>.</p></blockquote><p>Select the &quot;SDK Platforms&quot; tab from within the SDK Manager, then check the box next to &quot;Show Package Details&quot; in the bottom right corner. Look for and expand the <code>Android 10 (Q)</code> entry, then make sure the following items are checked:</p><ul><li><code>Android SDK Platform 29</code></li><li><code>Intel x86 Atom_64 System Image</code> or <code>Google APIs Intel x86 Atom System Image</code></li></ul><p>Next, select the &quot;SDK Tools&quot; tab and check the box next to &quot;Show Package Details&quot; here as well. Look for and expand the &quot;Android SDK Build-Tools&quot; entry, then make sure that <code>29.0.2</code> is selected and check the &quot;Android SDK Command-line Tools (latest)&quot;.</p><p>Finally, click &quot;Apply&quot; to download and install the Android SDK and related build tools.</p><h4>3. Configure the ANDROID_HOME environment variable</h4><p>The React Native tools require some environment variables to be set up in order to build apps with native code.</p><p>Add the following lines to your <code>$HOME/.bash_profile</code> or <code>$HOME/.bashrc</code> (if you are using <code>zsh</code> then <code>~/.zprofile</code> or <code>~/.zshrc</code>) config file:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable" style="color:#cb4b16">ANDROID_HOME</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$HOME</span><span class="token plain">/Library/Android/sdk</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant" style="color:#5a9bcf">PATH</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$PATH</span><span class="token builtin class-name" style="color:#fac863">:</span><span class="token variable" style="color:#cb4b16">$ANDROID_HOME</span><span class="token plain">/emulator</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant" style="color:#5a9bcf">PATH</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$PATH</span><span class="token builtin class-name" style="color:#fac863">:</span><span class="token variable" style="color:#cb4b16">$ANDROID_HOME</span><span class="token plain">/tools</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant" style="color:#5a9bcf">PATH</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$PATH</span><span class="token builtin class-name" style="color:#fac863">:</span><span class="token variable" style="color:#cb4b16">$ANDROID_HOME</span><span class="token plain">/tools/bin</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant" style="color:#5a9bcf">PATH</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$PATH</span><span class="token builtin class-name" style="color:#fac863">:</span><span class="token variable" style="color:#cb4b16">$ANDROID_HOME</span><span class="token plain">/platform-tools</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><blockquote><p><code>.bash_profile</code> is specific to <code>bash</code>. If you&#x27;re using another shell, you will need to edit the appropriate shell-specific config file.</p></blockquote><p>Type <code>source $HOME/.bash_profile</code> for <code>bash</code> or <code>source $HOME/.zprofile</code> to load the config into your current shell. Verify that ANDROID_HOME has been set by running <code>echo $ANDROID_HOME</code> and the appropriate directories have been added to your path by running <code>echo $PATH</code>.</p><blockquote><p>Please make sure you use the correct Android SDK path. You can find the actual location of the SDK in the Android Studio &quot;Preferences&quot; dialog, under <strong>Appearance &amp; Behavior</strong><strong>System Settings</strong><strong>Android SDK</strong>.</p></blockquote><h3>React Native Command Line Interface</h3><p>React Native has a built-in command line interface. Rather than install and manage a specific version of the CLI globally, we recommend you access the current version at runtime using <code>npx</code>, which ships with Node.js. With <code>npx react-native &lt;command&gt;</code>, the current stable version of the CLI will be downloaded and executed at the time the command is run.</p><h2>Creating a new application</h2><blockquote><p>If you previously installed a global <code>react-native-cli</code> package, please remove it as it may cause unexpected issues.</p></blockquote><p>React Native has a built-in command line interface, which you can use to generate a new project. You can access it without installing anything globally using <code>npx</code>, which ships with Node.js. Let&#x27;s create a new React Native project called &quot;AwesomeProject&quot;:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeProject</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>This is not necessary if you are integrating React Native into an existing application, if you &quot;ejected&quot; from Expo, or if you&#x27;re adding Android support to an existing React Native project (see <a href="/docs/integration-with-existing-apps">Integration with Existing Apps</a>). You can also use a third-party CLI to init your React Native app, such as <a href="https://github.com/infinitered/ignite" target="_blank" rel="noopener noreferrer">Ignite CLI</a>.</p><h3>[Optional] Using a specific version or template</h3><p>If you want to start a new project with a specific React Native version, you can use the <code>--version</code> argument:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeProject --version X.XX.X</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>You can also start a project with a custom React Native template, like TypeScript, with <code>--template</code> argument:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeTSProject --template react-native-template-typescript</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><h2>Preparing the Android device</h2><p>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.</p><p>Either way, you will need to prepare the device to run Android apps for development.</p><h3>Using a physical device</h3><p>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 following the instructions <a href="/docs/running-on-device">here</a>.</p><h3>Using a virtual device</h3><p>If you use Android Studio to open <code>./AwesomeProject/android</code>, you can see the list of available Android Virtual Devices (AVDs) by opening the &quot;AVD Manager&quot; from within Android Studio. Look for an icon that looks like this:</p><p><img alt="Android Studio AVD Manager" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAZCAIAAABCYLJOAAACLUlEQVR4Ab2Vw6IfPxiG3zfJHPPP2rbdfW3rProsLqCr7rqsbVur2raPPb+Z5Du2+YyRJ87HtLQ0dAIKnYNBQ5BEI4hI271BEIjUNZAgqbUm2WovyRLpyVMnfd83xggq3ATDMHTOzZo1q3ev3iRbXV4RKZEuXLBQayPOAQSESjlnDx85nJ+fjwpa7zUlaHPj2CO/oLTUNnTR8Wb2kvGeZ9rVbwJxTuArm69haAMaqtJXgnZ5y1tVmxKsMoqgKS0p2z1+WdEgItWXjp4XJEiCHesVZ50LnbUOrcE0LQURk2BsYHU0ASmnuqUgrfaSEAcvWs9eMQbKGe0J0L17j8TERJICW+hnx0Ylk6o17SAVF6U1lL3/bld+UbrAzpgx9f///4sEeT/TH955srMwkk2wNeUlROCsiBNCicu7dH+zH5BUgChapThh0NrYqCRpbTsoxZiEKBu60EbSsr+m5Z7RaoiIJQkQkv3lz8De/8/0tJEWekmKdSXb9MUjRYK7L3bk+996/7PpT/Zr6yIko0xcSsK0r2n33/+4NLjnXNIA0nz7kizy/b379ly6ckGIb+kPUhP7zZu5zTN/B/ZzaL+lxPecN2O7YsKbL2edOLLF5f3/v/+zsrOSk1MAxEb1z8j5dezaVggTYiYDyCnIP359q4gENl4EDdJwfLPWAiCplAptABEHp2oMKSfljzTaa0W/GVPxXkQ8EwWw5gCs+VhCK7w1/25o0ZHOj8dd7C0GRnwgNA5r8rwAAAAASUVORK5CYII="></p><p>If you have recently installed Android Studio, you will likely need to <a href="https://developer.android.com/studio/run/managing-avds.html" target="_blank" rel="noopener noreferrer">create a new AVD</a>. Select &quot;Create Virtual Device...&quot;, then pick any Phone from the list and click &quot;Next&quot;, then select the <strong>Q</strong> API Level 29 image.</p><p>Click &quot;Next&quot; then &quot;Finish&quot; 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.</p><h2>Running your React Native application</h2><h3>Step 1: Start Metro</h3><p>First, you will need to start Metro, the JavaScript bundler that ships with React Native. Metro &quot;takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies.&quot;<a href="https://facebook.github.io/metro/docs/concepts" target="_blank" rel="noopener noreferrer">Metro Docs</a></p><p>To start Metro, run <code>npx react-native start</code> inside your React Native project folder:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native start</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p><code>react-native start</code> starts Metro Bundler.</p><blockquote><p>If you use the Yarn package manager, you can use <code>yarn</code> instead of <code>npx</code> when running React Native commands inside an existing project.</p></blockquote><blockquote><p>If you&#x27;re familiar with web development, Metro is a lot like webpack—for React Native apps. Unlike Kotlin or Java, JavaScript isn&#x27;t compiled—and neither is React Native. Bundling isn&#x27;t the same as compiling, but it can help improve startup performance and translate some platform-specific JavaScript into more JavaScript.</p></blockquote><h3>Step 2: Start your application</h3><p>Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native run-android</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>If everything is set up correctly, you should see your new app running in your Android emulator shortly.</p><p><img alt="AwesomeProject on Android" src="/assets/images/GettingStartedAndroidSuccessMacOS-b854b8ed8b950832a43645e723a98961.png"></p><p><code>npx react-native run-android</code> is one way to run your app - you can also run it directly from within Android Studio.</p><blockquote><p>If you can&#x27;t get this to work, see the <a href="/docs/troubleshooting#content">Troubleshooting</a> page.</p></blockquote><h3>Modifying your app</h3><p>Now that you have successfully run the app, let&#x27;s modify it.</p><ul><li>Open <code>App.js</code> in your text editor of choice and edit some lines.</li><li>Press the <code>R</code> key twice or select <code>Reload</code> from the Developer Menu (<code>⌘M</code>) to see your changes!</li></ul><h3>That&#x27;s it!</h3><p>Congratulations! You&#x27;ve successfully run and modified your first React Native app.</p><center><img src="/docs/assets/GettingStartedCongratulations.png" width="150"></center><h2>Now what?</h2><ul><li>If you want to add this new React Native code to an existing application, check out the <a href="/docs/integration-with-existing-apps">Integration guide</a>.</li></ul><p>If you&#x27;re curious to learn more about React Native, check out the <a href="/docs/getting-started">Introduction to React Native</a>.</p></div><div role="tabpanel" hidden=""><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="installing-dependencies"></a>Installing dependencies<a class="hash-link" href="#installing-dependencies" title="Direct link to heading">#</a></h2><p>You will need Node, Watchman, the React Native command line interface, Xcode and CocoaPods.</p><p>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.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="node--watchman"></a>Node &amp; Watchman<a class="hash-link" href="#node--watchman" title="Direct link to heading">#</a></h3><p>We recommend installing Node and Watchman using <a href="http://brew.sh/" target="_blank" rel="noopener noreferrer">Homebrew</a>. Run the following commands in a Terminal after installing Homebrew:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">brew </span><span class="token function" style="color:#79b6f2">install</span><span class="token plain"> node</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">brew </span><span class="token function" style="color:#79b6f2">install</span><span class="token plain"> watchman</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>If you have already installed Node on your system, make sure it is Node 12 or newer.</p><p><a href="https://facebook.github.io/watchman" target="_blank" rel="noopener noreferrer">Watchman</a> is a tool by Facebook for watching changes in the filesystem. It is highly recommended you install it for better performance.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="xcode"></a>Xcode<a class="hash-link" href="#xcode" title="Direct link to heading">#</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" rel="noopener noreferrer">Mac App Store</a>. Installing Xcode will also install the iOS Simulator and all the necessary tools to build your iOS app.</p><p>If you have already installed Xcode on your system, make sure it is version 10 or newer.</p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="command-line-tools"></a>Command Line Tools<a class="hash-link" href="#command-line-tools" title="Direct link to heading">#</a></h4><p>You will also need to install the Xcode Command Line Tools. Open Xcode, then choose &quot;Preferences...&quot; 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.</p><p><img alt="Xcode Command Line Tools" src="/assets/images/GettingStartedXcodeCommandLineTools-8259be8d3ab8575bec2b71988163c850.png"></p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="installing-an-ios-simulator-in-xcode"></a>Installing an iOS Simulator in Xcode<a class="hash-link" href="#installing-an-ios-simulator-in-xcode" title="Direct link to heading">#</a></h4><p>To install a simulator, open <strong>Xcode &gt; Preferences...</strong> and select the <strong>Components</strong> tab. Select a simulator with the corresponding version of iOS you wish to use.</p><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="cocoapods"></a>CocoaPods<a class="hash-link" href="#cocoapods" title="Direct link to heading">#</a></h4><p><a href="https://cocoapods.org/" target="_blank" rel="noopener noreferrer">CocoaPods</a> is built with Ruby and it will be installable with the default Ruby available on macOS. You can use a Ruby Version manager, however we recommend that you use the standard Ruby available on macOS unless you know what you&#x27;re doing.</p><p>Using the default Ruby install will require you to use <code>sudo</code> when installing gems. (This is only an issue for the duration of the gem installation, though.)</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token function" style="color:#79b6f2">sudo</span><span class="token plain"> gem </span><span class="token function" style="color:#79b6f2">install</span><span class="token plain"> cocoapods</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>For more information, please visit <a href="https://guides.cocoapods.org/using/getting-started.html" target="_blank" rel="noopener noreferrer">CocoaPods Getting Started guide</a>.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="react-native-command-line-interface"></a>React Native Command Line Interface<a class="hash-link" href="#react-native-command-line-interface" title="Direct link to heading">#</a></h3><p>React Native has a built-in command line interface. Rather than install and manage a specific version of the CLI globally, we recommend you access the current version at runtime using <code>npx</code>, which ships with Node.js. With <code>npx react-native &lt;command&gt;</code>, the current stable version of the CLI will be downloaded and executed at the time the command is run.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="creating-a-new-application"></a>Creating a new application<a class="hash-link" href="#creating-a-new-application" title="Direct link to heading">#</a></h2><blockquote><p>If you previously installed a global <code>react-native-cli</code> package, please remove it as it may cause unexpected issues.</p></blockquote><p>You can use React Native&#x27;s built-in command line interface to generate a new project. Let&#x27;s create a new React Native project called &quot;AwesomeProject&quot;:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeProject</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>This is not necessary if you are integrating React Native into an existing application, if you &quot;ejected&quot; from Expo, or if you&#x27;re adding iOS support to an existing React Native project (see <a href="/docs/integration-with-existing-apps">Integration with Existing Apps</a>). You can also use a third-party CLI to init your React Native app, such as <a href="https://github.com/infinitered/ignite" target="_blank" rel="noopener noreferrer">Ignite CLI</a>.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="optional-using-a-specific-version-or-template"></a>[Optional] Using a specific version or template<a class="hash-link" href="#optional-using-a-specific-version-or-template" title="Direct link to heading">#</a></h3><p>If you want to start a new project with a specific React Native version, you can use the <code>--version</code> argument:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeProject --version X.XX.X</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>You can also start a project with a custom React Native template, like TypeScript, with <code>--template</code> argument:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeTSProject --template react-native-template-typescript</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><blockquote><p><strong>Note</strong> If the above command is failing, you may have old version of <code>react-native</code> or <code>react-native-cli</code> installed globally on your pc. Try uninstalling the cli and run the cli using <code>npx</code>.</p></blockquote><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="running-your-react-native-application"></a>Running your React Native application<a class="hash-link" href="#running-your-react-native-application" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="step-1-start-metro"></a>Step 1: Start Metro<a class="hash-link" href="#step-1-start-metro" title="Direct link to heading">#</a></h3><p>First, you will need to start Metro, the JavaScript bundler that ships with React Native. Metro &quot;takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies.&quot;<a href="https://facebook.github.io/metro/docs/concepts" target="_blank" rel="noopener noreferrer">Metro Docs</a></p><p>To start Metro, run <code>npx react-native start</code> inside your React Native project folder:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native start</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p><code>react-native start</code> starts Metro Bundler.</p><blockquote><p>If you use the Yarn package manager, you can use <code>yarn</code> instead of <code>npx</code> when running React Native commands inside an existing project.</p></blockquote><blockquote><p>If you&#x27;re familiar with web development, Metro is a lot like webpack—for React Native apps. Unlike Kotlin or Java, JavaScript isn&#x27;t compiled—and neither is React Native. Bundling isn&#x27;t the same as compiling, but it can help improve startup performance and translate some platform-specific JavaScript into more JavaScript.</p></blockquote><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="step-2-start-your-application"></a>Step 2: Start your application<a class="hash-link" href="#step-2-start-your-application" title="Direct link to heading">#</a></h3><p>Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native run-ios</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>You should see your new app running in the iOS Simulator shortly.</p><p><img alt="AwesomeProject on iOS" src="/assets/images/GettingStartediOSSuccess-e6dd7fc2baa303d1f30373d996a6e51d.png"></p><p><code>npx react-native run-ios</code> is one way to run your app. You can also run it directly from within Xcode.</p><blockquote><p>If you can&#x27;t get this to work, see the <a href="/docs/troubleshooting#content">Troubleshooting</a> page.</p></blockquote><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="running-on-a-device"></a>Running on a device<a class="hash-link" href="#running-on-a-device" title="Direct link to heading">#</a></h3><p>The above command will automatically run your app on the iOS Simulator by default. If you want to run the app on an actual physical iOS device, please follow the instructions <a href="/docs/running-on-device">here</a>.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="modifying-your-app"></a>Modifying your app<a class="hash-link" href="#modifying-your-app" title="Direct link to heading">#</a></h3><p>Now that you have successfully run the app, let&#x27;s modify it.</p><ul><li>Open <code>App.js</code> in your text editor of choice and edit some lines.</li><li>Hit <code>⌘R</code> in your iOS Simulator to reload the app and see your changes!</li></ul><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="thats-it"></a>That&#x27;s it!<a class="hash-link" href="#thats-it" title="Direct link to heading">#</a></h3><p>Congratulations! You&#x27;ve successfully run and modified your first React Native app.</p><center><img src="/docs/assets/GettingStartedCongratulations.png" width="150"></center><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="now-what"></a>Now what?<a class="hash-link" href="#now-what" title="Direct link to heading">#</a></h2><ul><li>If you want to add this new React Native code to an existing application, check out the <a href="/docs/integration-with-existing-apps">Integration guide</a>.</li></ul><p>If you&#x27;re curious to learn more about React Native, check out the <a href="/docs/getting-started">Introduction to React Native</a>.</p></div></div></div></div><div role="tabpanel" hidden=""><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="target-os-1"></a>Target OS<a class="hash-link" href="#target-os-1" title="Direct link to heading">#</a></h4><div><ul role="tablist" aria-orientation="horizontal" class="tabs pill-tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_2uuE tabs__item--active">Android</li><li role="tab" tabindex="0" aria-selected="false" class="tabs__item tabItem_2uuE">iOS</li></ul><div class="margin-vert--md"><div role="tabpanel"><h2>Installing dependencies</h2><p>You will need Node, the React Native command line interface, a JDK, and Android Studio.</p><p>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.</p><h3>Node, JDK</h3><p>We recommend installing Node via <a href="https://chocolatey.org" target="_blank" rel="noopener noreferrer">Chocolatey</a>, a popular package manager for Windows.</p><p>If you want to be able to switch between different Node versions, you might want to install Node via <a href="https://github.com/coreybutler/nvm-windows" target="_blank" rel="noopener noreferrer">nvm-windows</a>, a Node version manager for Windows.</p><p>React Native also requires <a href="https://openjdk.java.net/projects/jdk8/" target="_blank" rel="noopener noreferrer">Java SE Development Kit (JDK)</a>, which can be installed using Chocolatey as well.</p><p>Open an Administrator Command Prompt (right click Command Prompt and select &quot;Run as Administrator&quot;), then run the following command:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-powershell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">choco install -y nodejs.install openjdk8</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>If you have already installed Node on your system, make sure it is Node 12 or newer. If you already have a JDK on your system, make sure it is version 8 or newer.</p><blockquote><p>You can find additional installation options on <a href="https://nodejs.org/en/download/" target="_blank" rel="noopener noreferrer">Node&#x27;s Downloads page</a>.</p></blockquote><blockquote><p>If you&#x27;re using the latest version of Java Development Kit, you&#x27;ll need to change the Gradle version of your project so it can recognize the JDK. You can do that by going to <code>{project root folder}\android\gradle\wrapper\gradle-wrapper.properties</code> and changing the <code>distributionUrl</code> value to upgrade the Gradle version. You can check out <a href="https://gradle.org/releases/" target="_blank" rel="noopener noreferrer">here the lastest releases of Gradle</a>.</p></blockquote><h3>Android development environment</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>1. Install Android Studio</h4><p><a href="https://developer.android.com/studio/index.html" target="_blank" rel="noopener noreferrer">Download and install Android Studio</a>. While on Android Studio installation wizard, make sure the boxes next to all of the following items are checked:</p><ul><li><code>Android SDK</code></li><li><code>Android SDK Platform</code></li><li><code>Android Virtual Device</code></li><li>If you are not already using Hyper-V: <code>Performance (Intel ® HAXM)</code> (<a href="https://android-developers.googleblog.com/2018/07/android-emulator-amd-processor-hyper-v.html" target="_blank" rel="noopener noreferrer">See here for AMD or Hyper-V</a>)</li></ul><p>Then, click &quot;Next&quot; to install all of these components.</p><blockquote><p>If the checkboxes are grayed out, you will have a chance to install these components later on.</p></blockquote><p>Once setup has finalized and you&#x27;re presented with the Welcome screen, proceed to the next step.</p><h4>2. Install the Android SDK</h4><p>Android Studio installs the latest Android SDK by default. Building a React Native app with native code, however, requires the <code>Android 10 (Q)</code> SDK in particular. Additional Android SDKs can be installed through the SDK Manager in Android Studio.</p><p>To do that, open Android Studio, click on &quot;Configure&quot; button and select &quot;SDK Manager&quot;.</p><p><img alt="Android Studio Welcome" src="/assets/images/GettingStartedAndroidStudioWelcomeWindows-b88d46e9a7fe5e050224a9a295148222.png"></p><blockquote><p>The SDK Manager can also be found within the Android Studio &quot;Preferences&quot; dialog, under <strong>Appearance &amp; Behavior</strong><strong>System Settings</strong><strong>Android SDK</strong>.</p></blockquote><p>Select the &quot;SDK Platforms&quot; tab from within the SDK Manager, then check the box next to &quot;Show Package Details&quot; in the bottom right corner. Look for and expand the <code>Android 10 (Q)</code> entry, then make sure the following items are checked:</p><ul><li><code>Android SDK Platform 29</code></li><li><code>Intel x86 Atom_64 System Image</code> or <code>Google APIs Intel x86 Atom System Image</code></li></ul><p>Next, select the &quot;SDK Tools&quot; tab and check the box next to &quot;Show Package Details&quot; here as well. Look for and expand the &quot;Android SDK Build-Tools&quot; entry, then make sure that <code>29.0.2</code> is selected.</p><p>Finally, click &quot;Apply&quot; to download and install the Android SDK and related build tools.</p><h4>3. Configure the ANDROID_HOME environment variable</h4><p>The React Native tools require some environment variables to be set up in order to build apps with native code.</p><ol><li>Open the <strong>Windows Control Panel.</strong></li><li>Click on <strong>User Accounts,</strong> then click <strong>User Accounts</strong> again</li><li>Click on <strong>Change my environment variables</strong></li><li>Click on <strong>New...</strong> to create a new <code>ANDROID_HOME</code> user variable that points to the path to your Android SDK:</li></ol><p><img alt="ANDROID_HOME Environment Variable" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAo0AAAClCAMAAAAOEzcNAAABwlBMVEVfosv///8AAADMzMz//7ZmAABmtv9mADqQ2///25A6ADq2ZgA6kNv/tmYAZrYFBwg6AGa2//9mAGY6AAA6kJCQ27b//9uQOgAAAGZmZjq2/7aQtpDbkDoAADoAOpDb//86OpDb/9uQOjoAOmZmOjrw8PB6enqrYAA2h87wq2AAYKvwzoc2ADaHzvDw8KtgADZgq/A6OmY6OgA6Ojo2AGCr8PBgAGAAZmbw8M6HNgBgYDYAAGCr8KuHq4c2AACHh2DOhzYANofO8PBgAADb/7Y2NofO8M6HNjYAADZmtrYANmBgNjaQOmYAeNczmf/MZgCg7v//7v9amf/B//9/mf+gq/9/3v//3v/hzv8zq//h//8zvP/BvP+gvP/h7v/B7v/h3v9azv/B3v+gzv9gNoc2NmBgNmClZgAAYGCtra3h4eHh4aBaAABaoOEzf8HhwX8zADN/weFaADPhoFrh4cF/MwAAWqAAM3/B4eEzAFqg4eEAADOgWgAzAAB/oOHBfzNaWjMAAFozWqBaoKAzMwB/MzN/f1ozMzMzM3+gWjN/oH/B4cFaAFpaM39/waB/M1qgwX9aWlozM1paMzMAM1q/v7+vTvonAAAKLUlEQVR4Aeyd17arNhBAo3EBAnZyesO39957r+n5/7/JDBouxrfiNLO89wNiNOPztJdG4jzouxUCIACsBtgI2AiAjYCNANgI/bYRABsBsBGwEUAGcRzIJ20cjkRkXL0lafZ9qi8e+GORvNDHZBpq/Dde7QPAJxn8MPDh0zYmLQHt+SUbXcR8HFpgYwfQ0R7/jI3ZjxthuLmBjcuCjibjF23MtmQ7SYfJzkhkOmfj7p7I2LL7G8PkYF8l3N0b2/qYW51NHWqlB0dbUtiPYn34JICOLuOn941m2mgcylmqJi2sjZNazUkxHBXBKIvYqK14FO3z4Nhx3UTqW6wP3QBsdJmyE8ft7WMbs62iWjhFpp7R2pOn1DaRyl4ragL1VIdYH7oCdOpP27irwlVbxFDKWEevjKmjE8d1SkvcxibQNh7jALDsKabdqY382PGQT4NSeo/2jPlZhEndlW3ag1Fh/noDB1jiC89IxOwS2Y4q5rHH2vFFhZzYrtJatXdqQ82z9OkztY11cCAy9lNMl04NfP0G4D+DAGtgI2AjADYCNgJgI2AjADYCNgJgI2DjWYDVABsBGwGwEbARABsBGwGwEbARABsBGwGwEbARABsBGwGwEQAbARsBsBGwEQAbARsB/jkbAbDxHKwpK2ljgLUEG/8+gI2AjdgI2AjYeP6CPi5e+hBfvnI1vly7ftWHf9PGeGfXcOQXbPp9Ss097hOPNzc8tXCDsVf4n1DKWeo/hr7Z6CKev9Gu+e9szG6eSU2rW+Noo/plXtk42d8Ik5ld3VWYjZ5asLGpSG5XUyO/grOPYOPlO3fPXrt39/+ysSzKwrTSyzRrG/3CQgvtPuwYq42eamxsVyQHha2l95P+2oiNDx7esPXxvMglNe/R4ydqnwdPn8mFysbLz+Tx3crM56JTc/kbL2wiFlx8+aqrjXbdaxY9zIvaRr/M1S7XjPJpkdtoqbaNTUWys7mhLzt9tREbjRcXYqNW7a69jvZ58PKVbiLtTacuXrDZ15fOXjQv6/xFuWATsWAZG1VFNck9nLdxJDKt0iHGizaOxJilTYUKPdYfvImbT+3yPQQbL799915lEvnJtDPPmkA91UFXPhHbXrbzHswXdLbR2nTp28RpbaP66atea2301GfXRjMzH/sf6SfY+OD907evdPf44H0tWBNoG49xLP0o30wstW/0JW5/I162/nNr32imdto3ptVV7v21ERuNF9ZurSvXgnmgbVs18wZe0co3NnpB905tW0Nvs2ba1szP1GPzrD5Xa+xn6phqbGxX2LvY2GcbsVHN0kVQfvm1FqwOHonc8FNMq1O3ipuCJWzMC3uW1qObT4Wz1G0r443tMg5mo6cWbfxQYcvrbxtzHy2hA/wvpucANg5HwokZG1kb1xpsBGzERsBGwEZsBGxcT2AlbQTARsBGAGwEbATARsBGgH/PRgBsBGwEwMbf1xRYSRvDWgLYCN8ANv6xjvwZ+gM2YiM2YiM2YuNf7JzNrtsgEIXF81Tqri/QVVcWdhyDAze37v/7P0HnZBgfW02EarE0qgLM+RhS+YiJ7wLvXD9Ifxk7fF7140kjUG0Ko03hiSYbx//MD+FVzv2a+YYZ+SS7jYaBPN3Y/m5bxBu4cb5leYBveMa54kYClUa4m+/ve95SXAJn9fwqvMgJ6TU/30b8/+jG042t7rZt70af1zPla8WNBCqNcLfEJT51I0zCWT0/hBc5Ib3mUz8wouTpxiZ327Z3o5kCz8xf6UbU7yyWQZG7fHMjpgV4u6HMIjg5FzSQF4cgeHE3Yfmc70NZxA6Szx3Wo2wHHfELWCZNpSqEfc7vtmcUCd9HFwEsQU0oEDH5F043NrnbFihuIoOMOKRVlvgBN96H1Y0p0o0pdDpJEY9Tpwr0Q3IjgkpoQBAEYeDrBpb0sAQYEawzN/K40hG/QMnUeUTI7XMG23NxokZbBFCDynceFjXs6vN5Nra52xauJavxVT7mRiuYaO/D6sb5Vo46FxDClIB5KImMkQUfyaa8gVFSlwANwraDobheR/wClgkd9/k356Uck1BtEYPKI1tesXs8K3Wju21R0T/++Gyy4pSP/27ka4S333SLMzPgsWKqAN0I2T9x4xZ2aCN07MQOi7leR8y/dyO5fc66GzFDWwLdGE43NrrbFueonKSrTPzwW0xyj3dqqdT6GjHJQP+CsqBGmxsxVYBuTFZ3GcywBGFkVf9FCKVTOnN9GTF/Z5lQqcntc3JPLcG2iEHlpfOR2BRPN7a42xbtw89fn8g+fnJ+KfKhSq3luB/KM8aTw1T/SAdNK7VOAdCNQPv3nRvBb+Ep6smEdwy43joHzNZPLuhI80OMJdMDzdxnm9P2TM5eT3QRg0wYug3m+9+nG5vcbSuYdGSlZP8x+aAbty1FjtnqQBXmm8pf9u3YBmAYBIDghBnETvavMwAFTRDEuqtdIPEdclQ3QHzvFuMyGGvsokY1qjGnxhxqVCNqRI1qRI3t8GcQ8hpBjagR1AhqRI2gRtQIakSNoEbUCGpEjaBG1Li6TRrlX64SxetIaty91qxR1Fi7jnNrVOP+nBrVGKlRjdOpUY1qVKMa1Xg/L3vmoSM5CINhicdlAtks9RLmtvdeHviMibcXVuftSJP2U2Lxf+M4ihBCVUyLHbWU/crwMTS+MTKIa7E6NBpNsSmvhXWeiUbrhAjxeQdWByYaYaL+z1jhOXRcdL4iGAYa3xoZnTQazZQp1LgWSTPlxn6pYPf3Y2iErdJzoONDaayOrNFISUxJtAnWYs2zPKlpUik/hkbj4bC+MfbL/GhMCsV+07p8CeLGWDpiXHCkzqDnPludEF6WwdA0bUPsJkQOGqsjwz38SPydNFK6sDuwFrshMtF4k4NSNhpmxlrgjgl8NHYCpoODhk3lqhAIMHtarmnjiQn9gMZOz7p11FQGY1MelxRL3VgRGRWYhUYSfy2N+1EWmzpAhYvG/Ruu0X2wYWO8td5oztyIFFGRlhTc++Bw/2hn6JdaYsoT/obGHbK86DhE3hmMYB6Pi5PIUzfWRka58UZsufFwZeDOjUaICQ2BLYtkAiuNJeOR53bn9OTo7Dz/H9aEQvFu3Ug0ov4kjXJNr2meurE+MqKRRNnqRkhgvHUjTGt3HtCIe/bcSA9bmH0tPw0vkKc1vehmsKjHTGPRb9I1DS7MXl5hwOX3PzRWR0Y0FvHm3r/wnRoQpEpqLUQWGqUR+E5tQpwNgQ2tnzFgrRsnnB7TLpxmBHAzWLeBKPxtR6Kx6KgqmcpbDM0jk5cMNNZGdpfGIv5iGvPaCDUvSgqRg8ZidojWiesronG2ntb7C3+LSap9i2nfYr4Ijf1+bDQ2Gr8EjdZNQ/tO/a+dO7YBAISBGMj+/e/LEki4uJvBShqCGr2aUKMa1ahGNapRjWp8x5XWby5YXbCCvyZAjagR1EjfpkbUCDY1UZvZiBpJs6kxGM1G1Ag2NXkHOi61IHl9uT0p7gAAAABJRU5ErkJggg=="></p><p>The SDK is installed, by default, at the following location:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-powershell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">%LOCALAPPDATA%\Android\Sdk</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>You can find the actual location of the SDK in the Android Studio &quot;Settings&quot; dialog, under <strong>Appearance &amp; Behavior</strong><strong>System Settings</strong><strong>Android SDK</strong>.</p><p>Open a new Command Prompt window to ensure the new environment variable is loaded before proceeding to the next step.</p><ol><li>Open powershell</li><li>Copy and paste <strong>Get-ChildItem -Path Env:\</strong> into powershell</li><li>Verify <code>ANDROID_HOME</code> has been added</li></ol><h4>4. Add platform-tools to Path</h4><ol><li>Open the <strong>Windows Control Panel.</strong></li><li>Click on <strong>User Accounts,</strong> then click <strong>User Accounts</strong> again</li><li>Click on <strong>Change my environment variables</strong></li><li>Select the <strong>Path</strong> variable.</li><li>Click <strong>Edit.</strong></li><li>Click <strong>New</strong> and add the path to platform-tools to the list.</li></ol><p>The default location for this folder is:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-powershell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">%LOCALAPPDATA%\Android\Sdk\platform-tools</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><h3>React Native Command Line Interface</h3><p>React Native has a built-in command line interface. Rather than install and manage a specific version of the CLI globally, we recommend you access the current version at runtime using <code>npx</code>, which ships with Node.js. With <code>npx react-native &lt;command&gt;</code>, the current stable version of the CLI will be downloaded and executed at the time the command is run.</p><h2>Creating a new application</h2><blockquote><p>If you previously installed a global <code>react-native-cli</code> package, please remove it as it may cause unexpected issues.</p></blockquote><p>React Native has a built-in command line interface, which you can use to generate a new project. You can access it without installing anything globally using <code>npx</code>, which ships with Node.js. Let&#x27;s create a new React Native project called &quot;AwesomeProject&quot;:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeProject</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>This is not necessary if you are integrating React Native into an existing application, if you &quot;ejected&quot; from Expo, or if you&#x27;re adding Android support to an existing React Native project (see <a href="/docs/integration-with-existing-apps">Integration with Existing Apps</a>). You can also use a third-party CLI to init your React Native app, such as <a href="https://github.com/infinitered/ignite" target="_blank" rel="noopener noreferrer">Ignite CLI</a>.</p><h3>[Optional] Using a specific version or template</h3><p>If you want to start a new project with a specific React Native version, you can use the <code>--version</code> argument:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeProject --version X.XX.X</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>You can also start a project with a custom React Native template, like TypeScript, with <code>--template</code> argument:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeTSProject --template react-native-template-typescript</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><h2>Preparing the Android device</h2><p>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.</p><p>Either way, you will need to prepare the device to run Android apps for development.</p><h3>Using a physical device</h3><p>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 following the instructions <a href="/docs/running-on-device">here</a>.</p><h3>Using a virtual device</h3><p>If you use Android Studio to open <code>./AwesomeProject/android</code>, you can see the list of available Android Virtual Devices (AVDs) by opening the &quot;AVD Manager&quot; from within Android Studio. Look for an icon that looks like this:</p><p><img alt="Android Studio AVD Manager" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAZCAIAAABCYLJOAAACLUlEQVR4Ab2Vw6IfPxiG3zfJHPPP2rbdfW3rProsLqCr7rqsbVur2raPPb+Z5Du2+YyRJ87HtLQ0dAIKnYNBQ5BEI4hI271BEIjUNZAgqbUm2WovyRLpyVMnfd83xggq3ATDMHTOzZo1q3ev3iRbXV4RKZEuXLBQayPOAQSESjlnDx85nJ+fjwpa7zUlaHPj2CO/oLTUNnTR8Wb2kvGeZ9rVbwJxTuArm69haAMaqtJXgnZ5y1tVmxKsMoqgKS0p2z1+WdEgItWXjp4XJEiCHesVZ50LnbUOrcE0LQURk2BsYHU0ASmnuqUgrfaSEAcvWs9eMQbKGe0J0L17j8TERJICW+hnx0Ylk6o17SAVF6U1lL3/bld+UbrAzpgx9f///4sEeT/TH955srMwkk2wNeUlROCsiBNCicu7dH+zH5BUgChapThh0NrYqCRpbTsoxZiEKBu60EbSsr+m5Z7RaoiIJQkQkv3lz8De/8/0tJEWekmKdSXb9MUjRYK7L3bk+996/7PpT/Zr6yIko0xcSsK0r2n33/+4NLjnXNIA0nz7kizy/b379ly6ckGIb+kPUhP7zZu5zTN/B/ZzaL+lxPecN2O7YsKbL2edOLLF5f3/v/+zsrOSk1MAxEb1z8j5dezaVggTYiYDyCnIP359q4gENl4EDdJwfLPWAiCplAptABEHp2oMKSfljzTaa0W/GVPxXkQ8EwWw5gCs+VhCK7w1/25o0ZHOj8dd7C0GRnwgNA5r8rwAAAAASUVORK5CYII="></p><p>If you have recently installed Android Studio, you will likely need to <a href="https://developer.android.com/studio/run/managing-avds.html" target="_blank" rel="noopener noreferrer">create a new AVD</a>. Select &quot;Create Virtual Device...&quot;, then pick any Phone from the list and click &quot;Next&quot;, then select the <strong>Q</strong> API Level 29 image.</p><blockquote><p>If you don&#x27;t have HAXM installed, click on &quot;Install HAXM&quot; or follow <a href="https://github.com/intel/haxm/wiki/Installation-Instructions-on-Windows" target="_blank" rel="noopener noreferrer">these instructions</a> to set it up, then go back to the AVD Manager.</p></blockquote><p>Click &quot;Next&quot; then &quot;Finish&quot; 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.</p><h2>Running your React Native application</h2><h3>Step 1: Start Metro</h3><p>First, you will need to start Metro, the JavaScript bundler that ships with React Native. Metro &quot;takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies.&quot;<a href="https://facebook.github.io/metro/docs/concepts" target="_blank" rel="noopener noreferrer">Metro Docs</a></p><p>To start Metro, run <code>npx react-native start</code> inside your React Native project folder:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native start</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p><code>react-native start</code> starts Metro Bundler.</p><blockquote><p>If you use the Yarn package manager, you can use <code>yarn</code> instead of <code>npx</code> when running React Native commands inside an existing project.</p></blockquote><blockquote><p>If you&#x27;re familiar with web development, Metro is a lot like webpack—for React Native apps. Unlike Kotlin or Java, JavaScript isn&#x27;t compiled—and neither is React Native. Bundling isn&#x27;t the same as compiling, but it can help improve startup performance and translate some platform-specific JavaScript into more JavaScript.</p></blockquote><h3>Step 2: Start your application</h3><p>Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native run-android</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>If everything is set up correctly, you should see your new app running in your Android emulator shortly.</p><p><img alt="AwesomeProject on Android" src="/assets/images/GettingStartedAndroidSuccessWindows-7ae949ba8187936ba342678c432d78f6.png"></p><p><code>npx react-native run-android</code> is one way to run your app - you can also run it directly from within Android Studio.</p><blockquote><p>If you can&#x27;t get this to work, see the <a href="/docs/troubleshooting#content">Troubleshooting</a> page.</p></blockquote><h3>Modifying your app</h3><p>Now that you have successfully run the app, let&#x27;s modify it.</p><ul><li>Open <code>App.js</code> in your text editor of choice and edit some lines.</li><li>Press the <code>R</code> key twice or select <code>Reload</code> from the Developer Menu (<code>Ctrl + M</code>) to see your changes!</li></ul><h3>That&#x27;s it!</h3><p>Congratulations! You&#x27;ve successfully run and modified your first React Native app.</p><center><img src="/docs/assets/GettingStartedCongratulations.png" width="150"></center><h2>Now what?</h2><ul><li>If you want to add this new React Native code to an existing application, check out the <a href="/docs/integration-with-existing-apps">Integration guide</a>.</li></ul><p>If you&#x27;re curious to learn more about React Native, check out the <a href="/docs/getting-started">Introduction to React Native</a>.</p></div><div role="tabpanel" hidden=""><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="unsupported"></a>Unsupported<a class="hash-link" href="#unsupported" title="Direct link to heading">#</a></h2><blockquote><p>A Mac is required to build projects with native code for iOS. You can follow the <strong>Expo CLI Quickstart</strong> to learn how to build your app using Expo instead.</p></blockquote></div></div></div></div><div role="tabpanel"><h4><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="target-os-2"></a>Target OS<a class="hash-link" href="#target-os-2" title="Direct link to heading">#</a></h4><div><ul role="tablist" aria-orientation="horizontal" class="tabs pill-tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_2uuE tabs__item--active">Android</li><li role="tab" tabindex="0" aria-selected="false" class="tabs__item tabItem_2uuE">iOS</li></ul><div class="margin-vert--md"><div role="tabpanel"><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="installing-dependencies"></a>Installing dependencies<a class="hash-link" href="#installing-dependencies" title="Direct link to heading">#</a></h2><p>You will need Node, the React Native command line interface, a JDK, and Android Studio.</p><p>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.</p><h3>Node</h3><p>Follow the <a href="https://nodejs.org/en/download/package-manager/" target="_blank" rel="noopener noreferrer">installation instructions for your Linux distribution</a> to install Node 12 or newer.</p><h3>Java Development Kit</h3><p>React Native requires at least the version 8 of the Java SE Development Kit (JDK). You may download and install <a href="http://openjdk.java.net" target="_blank" rel="noopener noreferrer">OpenJDK</a> from <a href="https://adoptopenjdk.net/" target="_blank" rel="noopener noreferrer">AdoptOpenJDK</a> or your system packager. You may also <a href="https://www.oracle.com/java/technologies/javase-jdk14-downloads.html" target="_blank" rel="noopener noreferrer">Download and install Oracle JDK 14</a> if desired.</p><h3>Android development environment</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>1. Install Android Studio</h4><p><a href="https://developer.android.com/studio/index.html" target="_blank" rel="noopener noreferrer">Download and install Android Studio</a>. While on Android Studio installation wizard, make sure the boxes next to all of the following items are checked:</p><ul><li><code>Android SDK</code></li><li><code>Android SDK Platform</code></li><li><code>Android Virtual Device</code></li></ul><p>Then, click &quot;Next&quot; to install all of these components.</p><blockquote><p>If the checkboxes are grayed out, you will have a chance to install these components later on.</p></blockquote><p>Once setup has finalized and you&#x27;re presented with the Welcome screen, proceed to the next step.</p><h4>2. Install the Android SDK</h4><p>Android Studio installs the latest Android SDK by default. Building a React Native app with native code, however, requires the <code>Android 10 (Q)</code> SDK in particular. Additional Android SDKs can be installed through the SDK Manager in Android Studio.</p><p>To do that, open Android Studio, click on &quot;Configure&quot; button and select &quot;SDK Manager&quot;.</p><blockquote><p>The SDK Manager can also be found within the Android Studio &quot;Preferences&quot; dialog, under <strong>Appearance &amp; Behavior</strong><strong>System Settings</strong><strong>Android SDK</strong>.</p></blockquote><p>Select the &quot;SDK Platforms&quot; tab from within the SDK Manager, then check the box next to &quot;Show Package Details&quot; in the bottom right corner. Look for and expand the <code>Android 10 (Q)</code> entry, then make sure the following items are checked:</p><ul><li><code>Android SDK Platform 29</code></li><li><code>Intel x86 Atom_64 System Image</code> or <code>Google APIs Intel x86 Atom System Image</code></li></ul><p>Next, select the &quot;SDK Tools&quot; tab and check the box next to &quot;Show Package Details&quot; here as well. Look for and expand the &quot;Android SDK Build-Tools&quot; entry, then make sure that <code>29.0.2</code> is selected.</p><p>Finally, click &quot;Apply&quot; to download and install the Android SDK and related build tools.</p><h4>3. Configure the ANDROID_HOME environment variable</h4><p>The React Native tools require some environment variables to be set up in order to build apps with native code.</p><p>Add the following lines to your <code>$HOME/.bash_profile</code> or <code>$HOME/.bashrc</code> (if you are using <code>zsh</code> then <code>~/.zprofile</code> or <code>~/.zshrc</code>) config file:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable" style="color:#cb4b16">ANDROID_HOME</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$HOME</span><span class="token plain">/Android/Sdk</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant" style="color:#5a9bcf">PATH</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$PATH</span><span class="token builtin class-name" style="color:#fac863">:</span><span class="token variable" style="color:#cb4b16">$ANDROID_HOME</span><span class="token plain">/emulator</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant" style="color:#5a9bcf">PATH</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$PATH</span><span class="token builtin class-name" style="color:#fac863">:</span><span class="token variable" style="color:#cb4b16">$ANDROID_HOME</span><span class="token plain">/tools</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant" style="color:#5a9bcf">PATH</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$PATH</span><span class="token builtin class-name" style="color:#fac863">:</span><span class="token variable" style="color:#cb4b16">$ANDROID_HOME</span><span class="token plain">/tools/bin</span></div><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain"></span><span class="token builtin class-name" style="color:#fac863">export</span><span class="token plain"> </span><span class="token assign-left variable environment constant" style="color:#5a9bcf">PATH</span><span class="token operator" style="color:#fc929e">=</span><span class="token environment constant" style="color:#5a9bcf">$PATH</span><span class="token builtin class-name" style="color:#fac863">:</span><span class="token variable" style="color:#cb4b16">$ANDROID_HOME</span><span class="token plain">/platform-tools</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><blockquote><p><code>.bash_profile</code> is specific to <code>bash</code>. If you&#x27;re using another shell, you will need to edit the appropriate shell-specific config file.</p></blockquote><p>Type <code>source $HOME/.bash_profile</code> for <code>bash</code> or <code>source $HOME/.zprofile</code> to load the config into your current shell. Verify that ANDROID_HOME has been set by running <code>echo $ANDROID_HOME</code> and the appropriate directories have been added to your path by running <code>echo $PATH</code>.</p><blockquote><p>Please make sure you use the correct Android SDK path. You can find the actual location of the SDK in the Android Studio &quot;Preferences&quot; dialog, under <strong>Appearance &amp; Behavior</strong><strong>System Settings</strong><strong>Android SDK</strong>.</p></blockquote><h3>Watchman</h3><p>Follow the <a href="https://facebook.github.io/watchman/docs/install/#buildinstall" target="_blank" rel="noopener noreferrer">Watchman installation guide</a> to compile and install Watchman from source.</p><blockquote><p><a href="https://facebook.github.io/watchman/docs/install/" target="_blank" rel="noopener noreferrer">Watchman</a> is a tool by Facebook for watching changes in the filesystem. It is highly recommended you install it for better performance and increased compatibility in certain edge cases (translation: you may be able to get by without installing this, but your mileage may vary; installing this now may save you from a headache later).</p></blockquote><h3>React Native Command Line Interface</h3><p>React Native has a built-in command line interface. Rather than install and manage a specific version of the CLI globally, we recommend you access the current version at runtime using <code>npx</code>, which ships with Node.js. With <code>npx react-native &lt;command&gt;</code>, the current stable version of the CLI will be downloaded and executed at the time the command is run.</p><h2>Creating a new application</h2><blockquote><p>If you previously installed a global <code>react-native-cli</code> package, please remove it as it may cause unexpected issues.</p></blockquote><p>React Native has a built-in command line interface, which you can use to generate a new project. You can access it without installing anything globally using <code>npx</code>, which ships with Node.js. Let&#x27;s create a new React Native project called &quot;AwesomeProject&quot;:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeProject</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>This is not necessary if you are integrating React Native into an existing application, if you &quot;ejected&quot; from Expo, or if you&#x27;re adding Android support to an existing React Native project (see <a href="/docs/integration-with-existing-apps">Integration with Existing Apps</a>). You can also use a third-party CLI to init your React Native app, such as <a href="https://github.com/infinitered/ignite" target="_blank" rel="noopener noreferrer">Ignite CLI</a>.</p><h3>[Optional] Using a specific version or template</h3><p>If you want to start a new project with a specific React Native version, you can use the <code>--version</code> argument:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeProject --version X.XX.X</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>You can also start a project with a custom React Native template, like TypeScript, with <code>--template</code> argument:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native init AwesomeTSProject --template react-native-template-typescript</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><h2>Preparing the Android device</h2><p>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.</p><p>Either way, you will need to prepare the device to run Android apps for development.</p><h3>Using a physical device</h3><p>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 following the instructions <a href="/docs/running-on-device">here</a>.</p><h3>Using a virtual device</h3><p>If you use Android Studio to open <code>./AwesomeProject/android</code>, you can see the list of available Android Virtual Devices (AVDs) by opening the &quot;AVD Manager&quot; from within Android Studio. Look for an icon that looks like this:</p><p><img alt="Android Studio AVD Manager" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAZCAIAAABCYLJOAAACLUlEQVR4Ab2Vw6IfPxiG3zfJHPPP2rbdfW3rProsLqCr7rqsbVur2raPPb+Z5Du2+YyRJ87HtLQ0dAIKnYNBQ5BEI4hI271BEIjUNZAgqbUm2WovyRLpyVMnfd83xggq3ATDMHTOzZo1q3ev3iRbXV4RKZEuXLBQayPOAQSESjlnDx85nJ+fjwpa7zUlaHPj2CO/oLTUNnTR8Wb2kvGeZ9rVbwJxTuArm69haAMaqtJXgnZ5y1tVmxKsMoqgKS0p2z1+WdEgItWXjp4XJEiCHesVZ50LnbUOrcE0LQURk2BsYHU0ASmnuqUgrfaSEAcvWs9eMQbKGe0J0L17j8TERJICW+hnx0Ylk6o17SAVF6U1lL3/bld+UbrAzpgx9f///4sEeT/TH955srMwkk2wNeUlROCsiBNCicu7dH+zH5BUgChapThh0NrYqCRpbTsoxZiEKBu60EbSsr+m5Z7RaoiIJQkQkv3lz8De/8/0tJEWekmKdSXb9MUjRYK7L3bk+996/7PpT/Zr6yIko0xcSsK0r2n33/+4NLjnXNIA0nz7kizy/b379ly6ckGIb+kPUhP7zZu5zTN/B/ZzaL+lxPecN2O7YsKbL2edOLLF5f3/v/+zsrOSk1MAxEb1z8j5dezaVggTYiYDyCnIP359q4gENl4EDdJwfLPWAiCplAptABEHp2oMKSfljzTaa0W/GVPxXkQ8EwWw5gCs+VhCK7w1/25o0ZHOj8dd7C0GRnwgNA5r8rwAAAAASUVORK5CYII="></p><p>If you have recently installed Android Studio, you will likely need to <a href="https://developer.android.com/studio/run/managing-avds.html" target="_blank" rel="noopener noreferrer">create a new AVD</a>. Select &quot;Create Virtual Device...&quot;, then pick any Phone from the list and click &quot;Next&quot;, then select the <strong>Q</strong> API Level 29 image.</p><blockquote><p>We recommend configuring <a href="https://developer.android.com/studio/run/emulator-acceleration.html#vm-linux" target="_blank" rel="noopener noreferrer">VM acceleration</a> on your system to improve performance. Once you&#x27;ve followed those instructions, go back to the AVD Manager.</p></blockquote><p>Click &quot;Next&quot; then &quot;Finish&quot; 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.</p><h2>Running your React Native application</h2><h3>Step 1: Start Metro</h3><p>First, you will need to start Metro, the JavaScript bundler that ships with React Native. Metro &quot;takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies.&quot;<a href="https://facebook.github.io/metro/docs/concepts" target="_blank" rel="noopener noreferrer">Metro Docs</a></p><p>To start Metro, run <code>npx react-native start</code> inside your React Native project folder:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native start</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p><code>react-native start</code> starts Metro Bundler.</p><blockquote><p>If you use the Yarn package manager, you can use <code>yarn</code> instead of <code>npx</code> when running React Native commands inside an existing project.</p></blockquote><blockquote><p>If you&#x27;re familiar with web development, Metro is a lot like webpack—for React Native apps. Unlike Kotlin or Java, JavaScript isn&#x27;t compiled—and neither is React Native. Bundling isn&#x27;t the same as compiling, but it can help improve startup performance and translate some platform-specific JavaScript into more JavaScript.</p></blockquote><h3>Step 2: Start your application</h3><p>Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:</p><div class="mdxCodeBlock_1daz"><div class="codeBlockContent_2es_"><div tabindex="0" class="prism-code language-shell codeBlock_27aQ thin-scrollbar"><div class="codeBlockLines_2rCb" style="color:#FFFFFF;background:#282C34"><div class="token-line" style="color:#FFFFFF;background:#282C34"><span class="token plain">npx react-native run-android</span></div></div></div><button type="button" aria-label="Copy code to clipboard" class="copyButton_2bml">Copy</button></div></div><p>If everything is set up correctly, you should see your new app running in your Android emulator shortly.</p><p><code>npx react-native run-android</code> is one way to run your app - you can also run it directly from within Android Studio.</p><blockquote><p>If you can&#x27;t get this to work, see the <a href="/docs/troubleshooting#content">Troubleshooting</a> page.</p></blockquote><h3>Modifying your app</h3><p>Now that you have successfully run the app, let&#x27;s modify it.</p><ul><li>Open <code>App.js</code> in your text editor of choice and edit some lines.</li><li>Press the <code>R</code> key twice or select <code>Reload</code> from the Developer Menu (<code>Ctrl + M</code>) to see your changes!</li></ul><h3>That&#x27;s it!</h3><p>Congratulations! You&#x27;ve successfully run and modified your first React Native app.</p><center><img src="/docs/assets/GettingStartedCongratulations.png" width="150"></center><h2>Now what?</h2><ul><li>If you want to add this new React Native code to an existing application, check out the <a href="/docs/integration-with-existing-apps">Integration guide</a>.</li></ul><p>If you&#x27;re curious to learn more about React Native, check out the <a href="/docs/getting-started">Introduction to React Native</a>.</p></div><div role="tabpanel" hidden=""><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="unsupported-1"></a>Unsupported<a class="hash-link" href="#unsupported-1" title="Direct link to heading">#</a></h2><blockquote><p>A Mac is required to build projects with native code for iOS. You can follow the <strong>Expo CLI Quickstart</strong> to learn how to build your app using Expo instead.</p></blockquote></div></div></div></div></div></div></div></div></div></div></article><div class="docMetadata margin-vert--xl"><div class="row"><div class="col"><a href="https://github.com/facebook/react-native-website/blob/master/website/versioned_docs/version-0.64/getting-started.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="1.2em" width="1.2em" preserveAspectRatio="xMidYMid meet" role="img" viewBox="0 0 40 40" class="iconEdit_2Hwv"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col text--right"><em><small class="docMetadata-updated">Last updated on <time datetime="2021-03-12T19:14:20.000Z" class="docLastUpdatedAt_1gIo">3/12/2021</time></small></em></div></div></div><div class="margin-vert--lg"><nav class="pagination-nav" aria-label="Blog list page navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/more-resources"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« More Resources</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/integration-with-existing-apps"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Integration with Existing Apps »</div></a></div></nav></div></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><h4 class="footer__title">Docs</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/getting-started">Getting Started</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/tutorial">Tutorial</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/components-and-apis">Components and APIs</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/more-resources">More Resources</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Community</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/help">The React Native Community</a></li><li class="footer__item"><a class="footer__link-item" href="/showcase">Who&#x27;s using React Native?</a></li><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">Ask Questions on Stack Overflow</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener noreferrer" class="footer__link-item">Contributor Guide</a></li><li class="footer__item"><a href="https://dev.to/t/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">DEV Community</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Find us</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/blog">Blog</a></li><li class="footer__item"><a href="https://twitter.com/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">More</h4><ul class="footer__items"><li class="footer__item"><a href="https://reactjs.org/" target="_blank" rel="noopener noreferrer" class="footer__link-item">React</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/privacy" target="_blank" rel="noopener noreferrer" class="footer__link-item">Privacy Policy</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/terms" target="_blank" rel="noopener noreferrer" class="footer__link-item">Terms of Service</a></li></ul></div></div><div class="footer__bottom text--center"><div class="margin-bottom--sm"><a href="https://opensource.facebook.com" target="_blank" rel="noopener noreferrer" class="footerLogoLink_3cAK"><img class="footer__logo" alt="Facebook Open Source Logo" src="/img/oss_logo.png"></a></div><div class="footer__copyright">Copyright © 2021 Facebook, Inc.</div></div></div></footer></div>
<script src="/styles.9d29dd5a.js"></script>
<script src="/runtime~main.acc4c949.js"></script>
<script src="/main.337c3f7c.js"></script>
<script src="/1.7a6193e2.js"></script>
<script src="/2.9b40dc51.js"></script>
<script src="/1089.caa7a648.js"></script>
<script src="/1f03ab5e.a02daabd.js"></script>
<script src="/17896441.b54b3e3c.js"></script>
<script src="/a2bc933b.926bd470.js"></script>
</body>
</html>