Skip to main content
Learn how to build release versions of your React Native app for Android distribution.

Overview

Building for Android production creates either:
  • APK (Android Package) - Direct installation file
  • AAB (Android App Bundle) - Recommended for Google Play Store

Prerequisites

1

Generate signing key

Create a keystore file for signing your app:
Keep this file secure and never commit it to version control.
2

Configure signing

Edit android/gradle.properties:
android/gradle.properties
Add to .gitignore:
.gitignore
3

Update build.gradle

Edit android/app/build.gradle:
android/app/build.gradle

Building APK

Debug APK

For testing purposes:
Output: android/app/build/outputs/apk/debug/app-debug.apk

Release APK

For production distribution:
Output: android/app/build/outputs/apk/release/app-release.apk

Install APK on Device

Building AAB (App Bundle)

Release AAB

Recommended for Google Play Store:
Output: android/app/build/outputs/bundle/release/app-release.aab
AAB files are uploaded to Google Play Store, which then generates optimized APKs for each device configuration.

Test AAB Locally

Use bundletool to test AAB files:

Build Variants

Custom Build Types

Define custom build types in android/app/build.gradle:
android/app/build.gradle

Build Specific Variant

Product Flavors

Create different app versions (e.g., free/paid):
android/app/build.gradle
Build:

Optimization

Enable Proguard

Minify and obfuscate code in android/app/build.gradle:
android/app/build.gradle

Proguard Rules

Add to android/app/proguard-rules.pro:
android/app/proguard-rules.pro

Enable App Bundle Optimization

android/app/build.gradle

Separate APKs per Architecture

android/app/build.gradle
This creates separate APKs:
  • app-armeabi-v7a-release.apk
  • app-arm64-v8a-release.apk
  • app-x86-release.apk
  • app-x86_64-release.apk
  • app-universal-release.apk

Version Management

Update Version

Edit android/app/build.gradle:
android/app/build.gradle
  • versionCode - Integer, must increment with each release
  • versionName - String, user-facing version (e.g., “1.1.0”)

Automate Version Bumping

Use Gradle task:
android/app/build.gradle

Gradle Commands

Clean Build

Build All Variants

List Tasks

Verbose Output

Offline Build

Continuous Integration

GitHub Actions

.github/workflows/android.yml

Troubleshooting

Build Failed - Out of Memory

Error: OutOfMemoryError: Java heap space Solution: Edit android/gradle.properties:

Missing Keystore

Error: Keystore file not found Solution: Ensure keystore path in gradle.properties is correct:

Proguard Crashes App

Solution: Add keep rules for packages causing issues in proguard-rules.pro:

Duplicate Resources

Error: Duplicate resources Solution:
android/app/build.gradle

Security Best Practices

  • Never commit keystores to version control
  • Use CI/CD secrets for automated builds
  • Keep separate keystores for debug and release
  • Back up keystores securely (losing them means you can’t update your app)
Use environment variables for sensitive data:
Always enable code shrinking and obfuscation for release builds to protect your source code.

Next Steps

Run Android

Run and test your app on Android

Publishing Guide

Learn how to publish to Google Play Store

Android Logs

Debug with Android logs

App Signing

Complete guide to app signing