Menu Close

How to run a React Native app on Windows: Setup React Native Environment

In this article, we will learn about How to run a React Native app on Windows: Setup React Native Environment. In this tutorial, we cover how to install Android Studio, set up an emulator, and develop and execute a React Native project. Please read all my articles on React here in this link.

What is React Native?

Facebook developed React Native, an open-source framework for building mobile applications using JavaScript and React. It enables developers to create apps for both iOS and Android platforms with a single codebase, significantly reducing development time and effort.

Prerequisites to Installing dependencies

We will need the below dependencies to start React Native.

Important points about setting up the Environment

If you have already installed Node on your system, make sure it is Node 18.18 or newer. If you already have a JDK on your system, we recommend JDK17. You may encounter problems using higher JDK versions.

Set Up Your Environment

Install Node

Install the latest version of Node here. Note that it must require Node 18.18 version or newer.

Install JDK

Let’s install the Java JDK here on this link, Make sure the JDK 17 should install to work on React Native. Install the JDK for Windows as per below highlighted. Note the installed path, it would be use further in add into Environment variables path.

android setup for react native environment
java-jdk-install

Android development environment

Setting up your development environment can be somewhat tedious if you’re new to Android development. If you’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.

install-android-studio

Install Android Studio

Download and install Android Studio. While on Android Studio installation wizard, make sure the boxes next to all of the following items are checked:

  • Android SDK
  • Android SDK Platform
  • Android Virtual Device
  • Download the Android Studio and follow the ongoing instructions to install.
  • Here we need at least 3+ GB storage, make sure you have sufficient storage on the system
install-android-studio-step1
  • On the below highlighted path, we have installed the Android Studio.
install-android-studio-step2
  • The Android Studio has been installed, let’s start the Android Studio and follow the ongoing instructions.
install-android-studio-start
install-android-studio-step3

install-android-studio-step4
  • Here on the path we our SDK is placed.
  • We need to accept the android sdk license

install-android-studio-step7

install-android-studio-step8
  • Clcick on SDK manager, and we need to install SDK tools of the highlighted

install-android-studio-step10

install-android-studio-step11

install-android-studio-step12

Create new Emulator

android-emulator

android-emulator-API 35

android-emulator-open

android-emulator-Pixel 6 Pro API 35

And if run the Emulator and the Environment path is not successfully configured, then you can see the below error.

android-emulator-issue

Configure the path into Environment Variables

  • Here we have provided ANDROID_HOME and JAVA_HOME in both user variables and system variables.
android-Environment-path
  • On the user Variables section, we need to add the jdk path, android sdk path and platform tools and emulator etc. On the same we can add into sysetm variable.
android-Environment-path-user-variables-path
android-Environment-path-system-variables-path

On last, we can see the Android Emulator is ran successfully,

android-emulator-mobile-removebg-preview

Create React Native Project

Install the React Native CLI (if you haven’t already):

npm install -g react-native-cli

Create a new project:

  • Replace MyProject with your desired project name
npx react-native init MyFirstApp

Navigate to your project directory and run the project using below command

cd MyFirstApp
npx react-native run-android

That’s it for this article, Here we ran successfully our React Native Project on Android Emulator.

Conclusion

In this article, we discussed about How to run a React Native app on Windows: Setup React Native Environment. Also, we covered how to install Android Studio, set up an emulator, and develop and execute a React Native project.

Leave behind your valuable queries and suggestions in the comment section below. Also, if you think this article helps you, do not forget to share this with your developer community. Happy Coding 🙂

Latest Post

Leave a Reply

Your email address will not be published. Required fields are marked *