Introduction
Before we get started, you’ll need to have the following installed on your machine:
• Android Studio
• React Native command line interface
Once you have these installed, you can create a new React Native project by running the following command:
react-native init ProjectName
Once your project has been created, you’ll need to open it in Android Studio. To do this, open Android Studio and click Open an existing Android Studio project. Then, navigate to the directory where your project is located and click Open.
Once your project is open in Android Studio, you can launch the simulator by clicking on the Run button in the toolbar. Then, select Run ‘app’. This will open the simulator and you should see your React Native app running inside it.
If you want to run your app on a real device, you’ll need to follow the instructions in the React Native documentation.
Setting up the environment
This section is all about setting up the environment for React Native. There are two ways to do this:
1. Using the React Native CLI
2. Using Android Studio
We will be using the React Native CLI in this section.
First, we need to install the React Native CLI. We can do this using npm:
npm install -g react-native-cli
Next, we need to create a new React Native project. We can do this using the CLI:
react-native init myproject
This will create a new React Native project in the myproject directory.
Once the project has been created, we need to open it in our text editor. I use Visual Studio Code, but you can use whatever you like.
In the project, we need to find the android directory. This is where we will be working with the Android Studio.
Before we can open the project in Android Studio, we need to make a few changes to the build.gradle file.
We need to change the compileSdkVersion to 28 and the buildToolsVersion to “28.0.3”.
We also need to add the following line under allprojects:
maven { url ‘https://maven.google.com’ }
Once we have made these changes, we can open the project in Android Studio.
In Android Studio, we need to open the AVD Manager and create a new virtual device. I recommend using a Pixel 3a with Android 9.0 Pie.
Once the virtual device has been created, we can run the React Native app on it.
react-native run-android
This will build the app and run it on the virtual device.
If everything has been set up correctly, you should see the following screen:

Congratulations! You have successfully set up the environment for React Native.
Creating a new project
Assuming that you have React-Native 0.61 installed, we will create a new project named “AwesomeProject”.
react-native init AwesomeProject
This will create a directory called “AwesomeProject” with all the files required to run a React-Native application.
Now that we have a project, we need to run it on an Android device.
First, we need to connect our Android device to our computer.
Then, we need to open the “AwesomeProject” folder in Android Studio.
Once Android Studio is open, click on the “Run” button to run the app on your Android device.
Adding react native to the project
Adding react native to the project:
React native is a JavaScript framework for building native mobile apps. It allows you to use React along with native code to build your app. In this article, we will show you how to add react native to the project.
There are two ways to add react native to the project. The first way is to use the react-native-cli tool and the second way is to use the create-react-native-app tool.
If you are using the react-native-cli tool, then you need to install the react-native package. To install the react-native package, you need to run the following command:
npm install -g react-native-cli
After the react-native package is installed, you need to create a new project. To create a new project, you need to run the following command:
react-native init project_name
Replace project_name with the name of your project.
Once the project is created, you need to navigate to the project directory and run the following command:
react-native run-android
This will run the app on the android device.
If you are using the create-react-native-app tool, then you don’t need to install the react-native package. To create a new project, you need to run the following command:
create-react-native-app project_name
Replace project_name with the name of your project.
Once the project is created, you need to navigate to the project directory and run the following command:
npm start
This will start the development server.
You need to open the project in the Expo app. To open the project in the Expo app, you need to scan the QR code.
You can also open the project in the Expo app by entering the URL in the app.
Once the project is open in the Expo app, you can run the app on the android device.
Running the app on android studio
Running the app on android studio:
1) To run your app on android studio, first make sure you have installed the required dependencies. You can find a list of all the required dependencies here.
2) Open up android studio and create a new project. Choose the “blank activity” template.
3) Once the project has been created, open up the “app” module in the project structure window and select the “dependencies” tab.
4) Click on the + button and select the “module dependency” option.
5) Select the “react-native” module and click “OK”.
6) Now open up the “build.gradle” file for the “app” module and make sure the following lines are present:
apply plugin: ‘com.android.application’
android {
…
}
dependencies {
compile project(‘:react-native’)
…
}
7) Now open up the “MainActivity.java” file and make the following changes:
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
@Override
protected String getMainComponentName() {
return “YourAppName”;
}
}
8) Make sure you replace “YourAppName” with the actual name of your app.
9) Now open up the “android” folder in your project (the one that contains the “app” module) and create a new file called “local.properties”.
10) Add the following line to the “local.properties” file:
sdk.dir=/path/to/android/sdk
11) Make sure you replace “/path/to/android/sdk” with the actual path to your android sdk.
12) Now open up a terminal and navigate to the root of your project.
13) Run the following command:
react-native run-android
14) This will start the react native packager and also build and launch your app on the android emulator.
Download and install Android Studio
The React Native framework allows you to build native mobile apps using JavaScript. In order to run a React Native app on your Android device, you will need to have the Android Studio development environment set up on your computer. This guide will show you how to download and install Android Studio, and get started with developing a React Native app.
Before you begin, make sure that you have the latest version of the Java SE Development Kit (JDK) installed on your computer. You can download the JDK from the Oracle website.
Once you have the JDK installed, download the Android Studio installer from the Android website. Run the installer, and follow the prompts to complete the installation.
Once Android Studio is installed, launch it, and click on the “Create New Project” button. In the “Select a Project Template” step, select the “Empty Activity” template, and click “Next”.
In the “Configure your new project” step, enter a name for your app, and click “Finish”. Android Studio will now create a new project for your app.
Once the project has been created, open the “app” folder, and open the file “MainActivity.java”. This file contains the code for the main activity of your app.
Replace the code in this file with the following:
package com.example.myapp;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected String getMainComponentName() {
return “MyApp”;
}
}
This code sets up the main activity of your app as a ReactActivity, which will give your app the ability to run React Native code.
Next, open the “app/src/main/res/layout/activity_main.xml” file. This file defines the layout of the main activity. Replace the code in this file with the following
Set up the Android Studio environment
There are a few things you need to set up before you can run your React Native app on Android. You will need to have the Android SDK and Android Studio installed. You will also need to set up a virtual device or use an existing Android device.
1. Install the Android SDK and Android Studio
First, you need to install the Android SDK and Android Studio. you can follow the instructions here. Once you have the Android SDK and Android Studio installed, you need to open Android Studio and set up a new project.
2. Set up a new project in Android Studio
Open Android Studio and create a new project. Select “Empty Activity” when prompted. Name your project and click “Finish”.
3. Add React Native to your project
Now that you have a project set up in Android Studio, you need to add React Native to the project. To do this, you need to add the following lines to the build.gradle file in your project:
apply from: “../../node_modules/react-native/react.gradle”
project.ext.react = [
entryFile: “index.js”
]
apply from: “../../node_modules/react-native/react.gradle”
Replace the “index.js” with the name of your entry file.
4. Set up a virtual device or use an existing Android device
Now you need to set up a virtual device or use an existing Android device. To set up a virtual device, open the AVD Manager in Android Studio. Create a new virtual device and select the device you want to use. I recommend using a device with at least Android 6.0 (Marshmallow).
5. Run your React Native app on your Android device or virtual device
Now that you have everything set up, you can run your React Native app on your Android device or virtual device. To do this, open a terminal and navigate to your project directory. Then run the following command:
react-native run-android
This will build your app and run it
Create a new React Native project
Are you looking for a quick way to create a new React Native project? If so, this guide is for you! In just a few simple steps, you can have a brand new React Native project up and running on your computer.
First, make sure you have the React Native CLI installed on your machine. If you don’t have it installed yet, you can do so by running the following command:
npm install -g react-native-cli
Once you have the CLI installed, create a new directory for your project. For this example, we’ll call it “MyProject”.
Once you’ve created your project directory, open a terminal and navigate to it. Then, run the following command to create a new React Native project:
react-native init MyProject
This will create a new React Native project with the default directory structure.
Next, you’ll need to open the project in your text editor of choice. I recommend using Visual Studio Code.
Once you have the project open in your text editor, you can run it on your Android device by opening a terminal and navigating to the project directory. Then, run the following command:
react-native run-android
If everything went well, you should see your new React Native app up and running on your Android device!
Run the app on your Android device
If you’re developing a React Native application, you’ll probably want to run it on your Android device at some point. Doing this is relatively simple, but there are a few things you’ll need to set up first.
Assuming you have all the necessary tools installed, the first thing you’ll need to do is create a new React Native project. Once you have your project set up, open it in your text editor and navigate to the android folder. In this folder, you’ll find a file called local.properties. Open this file and add the following line:
sdk.dir = /path/to/your/android/sdk
Replace /path/to/your/android/sdk with the actual path to your Android SDK. Once you’ve done this, save the file and close it.
Next, open your project in Android Studio. If you’re prompted to select a project, select the one with the same name as your React Native project. Once Android Studio has finished loading, open the AVD Manager from the Tools menu.
In the AVD Manager, create a new virtual device. Select a device that you want to emulate and choose a system image. Once you’ve done this, click the “Create AVD” button.
After your AVD has been created, select it and click the “Start” button. This will launch the emulator and load your React Native application.
If everything has been set up correctly, you should see your React Native application running in the emulator.