Setting up the development environment for React Native using native-cli

If you want to develop mobile applications using React Native, you need to set up the development environment for the React Native CLI. In this blog post, I will show you the steps to do that on Windows.

Installing dependencies

You will need Node, the React Native command line interface, a JDK, and Android Studio.

While you can use any editor of your choice to develop your app, you will need to install Android Studio in order to set up the necessary tooling to build your React Native app for Android.

We recommend installing Node via Chocolatey, a popular package manager for Windows. It is recommended to use an LTS version of Node. 

React Native also requires Java SE Development Kit (JDK), which can be installed using Chocolatey as well.

Open an Administrator Command Prompt (right click Command Prompt and select “Run as Administrator”), then run the following command:

PowerShell
choco install -y nodejs-lts microsoft-openjdk11

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

Note: If you don’t have Chocolatey installed, follow this Installation guide on windows.

Android development environment

Android Studio is an integrated development environment (IDE) that provides tools and emulators for developing Android applications. You can download and install Android Studio from https://developer.android.com/studio. During the installation, make sure you select the following components:

– Android SDK
– Android SDK Platform
– Android Virtual Device

You also need to set up some environment variables for the Android SDK. You can follow the instructions here: https://reactnative.dev/docs/environment-setup#android-development-environment

Create and run a React Native project

Now you are ready to create and run your first React Native project. You can use the React Native CLI to generate a project template:

PowerShell
react-native init MyProject

This will create a folder called MyProject with the necessary files and folders for a React Native project. To run the project on an Android emulator or device, you can use the following command:

PowerShell
react-native run-android

You should see your app running on the emulator or device. Congratulations, you have successfully set up the development environment for React Native CLI!

Related Posts

React-Native-TextInput

React Native TextInput

React Native, a popular framework for building cross-platform mobile applications, offers a plethora of components that empower developers to create engaging and interactive user interfaces. Among these,…

React-Native-Image-Component

React Native Image Component

Image Component is a powerful means of engaging users and conveying information in mobile applications. In React Native, images are an integral part of the user experience,…

React-Native-Text-Component

React Native Text Component

Text is a fundamental element in any mobile application, as it conveys information, instructions, and messages to users. In React Native, rendering text is achieved through the…

React-Native-View-Component.png

React Native View Component

Hey, welcome to my blog! Today I’m going to write about the component in React Native, which is one of the most basic and versatile components you…

Core-Component-Vs-Native-Component

Core Components Vs Native Components in React Native

Hey, what’s up? If you’re a React Native developer, you probably know that there are two types of components you can use in your app: core components…

Getting-Started-with-Native-Cli

Getting started with React Native using native-cli

Hey, welcome to my blog! In this post, I’m going to show you how to get started with React Native using native-cli. React Native is a framework…

Leave a Reply

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