Skip to main content

Build the Android app

There are two ways to build an Android app - you can use the react native cli on the terminal, or you can build it using Android Studio: the go-to integrated development environment (IDE) for building Android apps. We are now really venturing into native development in that these are the tools that native Android developers would use.

Installing dependencies#

Unlike with iOS where we have to install our native dependencies ourselves, the Android build and dependencies are managed using Gradle and they are installed automatically, so there is no equivalent yarn install / pod install step for Android.

Running the Android app (via Android Studio)#

Start packager#

First open the terminal and start the metro bundler:

yarn start# ornpm start

Technically this is optional - if you don't do this yourself, react native will open a new terminal window and do it for you, but I prefer the control of doing this manually.

Run the App via Android Studio#

Open Android Studio, choose "Open Existing project" (or just "Open" in the latest version of Android Studio), and open the /android folder.

Now it'll take a little while for the editor to finish configuring the project. You can see the latest logs at the bottom right corner of the editor.

If you haven't configured a virtual device yet, you can do so now: click on the ADV Manager icon at the top of the IDE (it's a phone with the Android logo on it) and choose "Create Virtual Device". From here you can configure the exact device you want to use. I recommend choosing the latest device with the latest version of the Android SDK.

Now choose which device you want to run your app on at the top of the IDE, to the left of the "play" icon. Once you're happy, click on the "play" icon to build the project.

Running the Android app (via the terminal)#

Before running the android app via the terminal, make sure you have an android emulator running or a device plugged in and ready for usb debugging.

Start packager#

In one tab, start the metro bundler

yarn start# ornpm start

Technically this is optional - if you don't do this yourself, react native will open a new terminal window and do it for you, but I prefer the control of doing this manually.

Run the app via the cli#

In another tab, build the native app

yarn android# ornpm run android
New Project Android