Setting up your Macbook for React Native and Android

Image for post
Image for post
Source: The Next Web

If you were like me and had never used Android Studio before, setting up your Mac for use with React Native and Android might be an error filled journey.

Image for post
Image for post

I’m going to walk you through how to set up and configure Android Studio for use with React Native and hopefully help you avoid an error filled journey.

Step 1: Follow the Getting Started guide for React Native

Note: You’ll need to have Java SE Dev Kit 8 installed on your Mac to use Android Studio.

Step 2: Set up environment variables in your ~/.bash_profile file

Here’s how to find where your Android SDK is located:

  1. Open Android Studio
  2. Configure > SDK Manager (Bottom Right)
  3. You should now see your Android SDK Location

Restart your Terminal after the above!

Step 3: Download an ABI (Application Binary Interface)

  1. Type android in your Terminal (if the command is not found make sure you’ve restarted your Terminal)
  2. Make sure that the Intel x86 Atom_64 System Image is installed.
Image for post
Image for post

Step 4: Create a new AVD (Android Virtual Device)

  1. Type the following in your Terminal

You should now see something like this:

Image for post
Image for post

2. Execute the following command

<name>- can be whatever you would like it to be, in my case I named it react.

<target>- Should be one of the ids output from android list targets. In my case I used 2.

Step 5: Run your Emulator

If you followed the above steps you should now be ready to run the following command in any React Native project without errors:

If you’re still getting errors Google should be able to help you solve most, but feel free to leave a comment if you’re not able to figure something out.

You Did It!

Image for post
Image for post

Assuming that you had no errors you’re ready to start building Android applications with React Native!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store