This Article Part of React Native Tutorial Series want to start from scrach follow below link

https://infinitbility.com/react-native/table-of-contents

Today, we setup react native environment in windows for run react native app.


Tools

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 14 or newer)
  • React Native command line interface (React Native CLI)
  • Java Development Kit (JDK 8 or newer)

Install Node JS

for setup react native you have to download and instal node.js.

https://nodejs.org/en/

Node

I recommend you install the LTS version.


Install Java SDK

Download and install the latest version of Java SDK from

https://www.oracle.com/java/technologies/javase-jdk8-downloads.html

( optional ) want to check all version of jdk

https://www.oracle.com/java/technologies/java-se-glance.html


Install Python 2

Download and install Python 2.7.15 from

https://www.python.org/downloads/windows/

  • alternative choice

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

    https://chocolatey.org/

    choco install -y nodejs.install python2 jdk8
    

Install Android Studio

Download and install the latest version of Android Studio for Windows from https://developer.android.com/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:

SDK Manager

Go to android sdk section

Android SDK

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

SDK Tools

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…)

Hyper-V feature

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

SDK location

Configure environment variables

Add the ANDROID_HOME variable on environment variables:

ANDROID_HOME variable

Add JAVA_HOME variable on environment variables:

ANDROID_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


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:

–version 0.60.4 - optional ( use when want install react native app specfic version instead latest )

react-native init myFirstReactNativeApp --version 0.55.4

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:

open-project

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”

gradlew-update

After open react native project on android studeio, go to Tools > ADV Manager:

avd-manager

after open avd manager, click on “Create Virtual Device”:

emuletor

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

create-emulator

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

android-os

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

emuletor-list

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

emuletor-view

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

npx react-native run-android
run-app

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

options

More From React Native Tutorial

Basics

1. Introduction To React Native

2. React Native Environment Setup using expo

3. React Native Environment Setup for windows

4. React Native Environment setup on Mac OS

5. React Native Environment setup on linux

6. React Native Project Structure

7. React Native State

8. React Native Props

9. React Native Styling

10. React Native Flexbox

11. React Native Text

12. React Native Textinput

13. React Native Commands

14. React Native ScrollView

Advances

1. React Native Dark Mode

2. React Native Fonts

3. React Native SQLite

4. React Native DatepickerAndroid

5. React native ScrollView scroll to position

6. How to align icon with text in react native

7. React Native Image

8. React Native Firebase Crashlytics

9. React Native Async Storage

10. React Native Share

Error & Issue Solution

1. Task :app:transformDexArchiveWithDexMergerForDebug FAILED In React Native

2. Expiring Daemon because JVM heap space is exhausted In React Native

3. Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED In React Native

4. Unable to determine the current character, it is not a string, number, array, or object in react native

5. App crashed immediately after install react native video or track player

6. how to delete SQLite database in android react native

7. React native material dropdown twice click issue

8. How to get the current route in react-navigation?

9. how to disable drawer on the drawer navigation screen?

10. Image not showing in ios 14 react native