How to create build React-native android

How to create build React-native android

Hi Guys, In this article, we are going to discuss How to create a test build React-native android, as a react-native developer we have to give test build to the client for testing. Android developers mostly use Android studio IDE to develop applications and create a build using Android studio but For React-native we have to run some command to create a build in react-native. let’s start with an example

Agenda:

1. Create index.android.bundle

2. Update index.android.bundle file

3. Create final Android build

1. Create index.android.bundle

This file is very important while building a react-native Android application. the location of this file is ProjectName\android\app\src\main\assets\index.android.bundle if this file isn’t available then you can create this file manually and update later using the following command

this command need to run every time before creating a build. this command builds all javascript code and update index.bundle.android file. if you want to run this command automatically then you have to add this command in package.json in script section like below

You can set –dev true for display developer option to developers if you are creating release build set to –dev false

How to create a test build React-native android

after completing this command next step is to build android project

2. Build an android project

Goto Android directory because we are building android project

Run the following command to build debug build

Goto the following location and check .apk file

ProjectName\android\app\build\outputs\apk\debug\app-debug.apk

You can install this app-debug.apk in your device

To create a release build for the client you can use the following command to build the App

3. Getting any error

If you will get some error gradlew assembleRelease not updating APK output file then you have to clean Android project using the following commands

Goto Android directory

Clean Android project

Build android project again

Thank you 🙂

 

2 Replies to “How to create build React-native android”

Leave a Reply

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