React Native tips — Setting Up your Development Environment (for Windows)

Leonardo Bruno Lima
5 min readAug 21, 2018

--

Hi guys! In this article I will talk about how to set up your development environment on Windows to use React Native and Android Studio.

These are the tools we need on an development environment (Windows):

  • Visual Studio Code (you can use any other editor or IDE)
  • Android Studio
  • Built-in emulator in Android Studio
  • Node Package Manager (NPM)
  • Node.js (Version 8 or newer)
  • React Native command line interface (React Native CLI)
  • Java Development Kit (JDK 8 or newer)

There are two ways to start a React Native Project: Using the React Native CLI or using Create React Native App. If you chose the second option, you don’t need to configure anything, just start coding and be happy. I will talk about the pros and cons of these two options.

Step 1: Install Node

I recommend you install the LTS version.

Step 2: Install Java SDK

Step 3: Install Python 2

You can use Chocolatey to install Node, Python2 and Java SDK together, to do it install Chocolatey and just type:

$ choco install -y nodejs.install python2 jdk8

Step 4: Install Android Studio

The Android Studio installs the latest Android SDK by default and React Native requires Android 6.0 (Marshmallow) SDK or higher.

Once installed you can go to Tools > SDK Manager and choose any version above 6.0.

If you didn’t have any project yet (our case), you should go to Configure > SDK Manager:

Now, go to SDK Tools tab and choose these options below:

You will need the Intel x86 Emulator Accelerator (HAXM installer) to run the emulator on Windows. For more information, please refer to the following link: https://github.com/intel/haxm/wiki/Installation-Instructions-on-Windows.

If you have Hyper-V feature enabled, you need to disable it (I know…)

Make sure if JDK location is selected. Go to File > Other Settings > Default Project Structure:

Step 5: Configure environment variables

  • Add the ANDROID_HOME variable:
  • Add JAVA_HOME variable:
  • Make sure you add on Path variable the path for Java SDK and Android platform tools:

C:\Users\{your_user_name}\AppData\Local\Android\Sdk\platform-tools
C:\Program Files\Java\jdk1.8.0_181\bin

Step 6: Install React Native CLI and create the first project

$ npm install -g react-native-cli

Finally you can create your first React Native application by running the following command in your workspace location:

$ react-native init myFirstReactNativeApp --version 0.55.4

The latest version, 0.56, has some issues on Windows, so, use 0.55.4

This will create the following project structure:

Before run you project we have to configure the emulator. Take a look at the folder android. We have to open it on Android Studio:

Click on “Open an existing Android Studio project”, go to your project and select the folder android and click Ok.

If Gradle ask you to update, click on “Don’t remind me again for this project”

Now, go to Tools > ADV Manager:

On this screen, click on “Create Virtual Device”:

You can select any device on the list and click next:

On the next screen select the System Image. Click on download to download the selected image.

Follow the instructions and finish. After that you can see the created virtual device on the list.

Now, just click on play and you can see the emulator running:

It’s time to run your project and see it on emulator. Just type:

$ react-native run-android

And voilà!

Now you can edit you app and reload the emulator to see the changes, just type “ctrl + m” and click Reload:

That´s all folks, I hope you can enjoy your first React Native App. Let me know if you have any question or if these steps didn’t work for you.

Thanks for reading!

--

--