How to Generate a Release APK Using Gradle (Step by Step) – React Native

When you build an Android app (native or React Native), you often need a Release APK — the file you can share with users or upload to the Play Store.
Let’s understand how this works with just two commands.


1️⃣ Move to the Android Folder

cd android

👉 Why?
Every Android/React Native project has an android folder. Inside it, you’ll find the Gradle build system files.
Gradle is the tool that actually builds your Android app.
So before we run Gradle commands, we must go inside the android directory.


2️⃣ Build the Release APK

./gradlew assembleRelease     # for Mac/Linux
gradlew assembleRelease       # for Windows

👉 What this does:

  • Runs the Gradle build system in release mode.
  • It compiles your Java/Kotlin code, bundles resources (images, layouts, etc.), and optimizes everything.
  • The result is an APK file that you can install on a device or publish.

3️⃣ Where to Find the APK

After the command finishes, you’ll see this path:

android/app/build/outputs/apk/release/app-release.apk

👉 Meaning:

  • android/ → the Android project folder
  • app/ → your app module
  • build/outputs/apk/release/ → Gradle puts the generated APKs here
  • app-release.apk → your final APK file

📦 Debug vs Release APK

  • Debug APK:
  • Release APK:
    • Built using assembleRelease.
    • Signed with your own keystore (for Play Store upload).
    • Optimized (smaller & faster).

🎯 Purpose of These Commands

  • cd android → Go inside the Android project where Gradle is located.
  • ./gradlew assembleRelease → Tell Gradle to build a release-ready APK.
  • android/app/build/outputs/apk/release/app-release.apk → Location of your generated APK.

With this APK:
✅ You can test the final production build on a real device.
✅ You can upload it to the Google Play Store after signing it with your keystore.


🎓 Final Takeaway

  • cd android → enter Android folder
  • ./gradlew assembleRelease → build release APK
  • app-release.apk → your final app file, ready to be shared or published

👉 Think of it like baking a cake:

  • cd android = entering the kitchen
  • ./gradlew assembleRelease = starting the baking process
  • app-release.apk = the finished cake 🎂

Leave a comment