React Native Build APK for Android.

Edison Devadoss
2 min readJul 29, 2019

--

In this article, I will explain how to build APK for android and what are the problems we may face in this progress and how to solve these problems.

Step 1:

Remove the ‘app-debug.apk’ file under this destination ‘android/app/build/outputs/debug/’.

Then execute comments in your terminal.

Step 2:

Run the below comments one by one.

$ react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res$ cd android
$ ./gradlew assembleDebug

Step: 3

Check if you get ‘app-debug.apk’ file where we already remove the same file. It is ok you have done the job no need to read further.

If we got an error like this we have to solve the problem.

How to solve this problem?

No need to worry about here I will explain.

Step 1:

Remove those images file starts ‘node_modules’ under this destination ‘android/app/build/intermediates/res/merged/debug/drawable*’ folder and also remove which file indicates in the terminal error message.

Step 2:

Add android.enableAapt2=false in gradle.properties file.

Then run again these comments.

$ react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res$ cd android$ ./gradlew assembleDebug

It runs successfully.

--

--

Edison Devadoss
Edison Devadoss

Written by Edison Devadoss

Software Engineer / Full Stack Developer / JavaScript / React / React Native / Firebase / Node.js / Book Reader

Responses (1)