Paramclasses Academy - Blog

Tutorials Details

←
Post 36 of 39
→

How to Generate an Android APK and AAB in React Native ?

How to Generate an Android APK and AAB in React Native ?

November 5, 2026

1. Introduction

After developing a React Native application, the next important step is to convert it into an Android application package.

Developers generate APK or AAB files to distribute their applications, test them on Android devices, and publish them on the Google Play Store.

React Native developers using Expo can generate these files easily with Expo Application Services (EAS Build).

In this tutorial, we will learn how to generate both APK and AAB files using EAS Build.

What You Will Learn

  • What is an APK file?

  • What is an AAB file?

  • Difference between APK and AAB

  • Introduction to EAS Build

  • Installing and configuring EAS CLI

  • Configuring app.json

  • Creating eas.json

  • Generating an Android APK

  • Generating an Android AAB

  • Understanding Android app signing

  • Downloading generated build files

  • Installing APK on an Android device

  • Preparing AAB for Google Play Store

  • Common build errors and solutions

2. What Is an APK File?

APK stands for Android Package Kit.

It is an Android application package that contains the files required to install and run an application on an Android device.

An APK file can be shared directly with users for installation.

For example:

MyReactNativeApp.apk

Uses of APK

  • Installing an application manually.

  • Testing applications on Android devices.

  • Sharing applications with testers.

  • Distributing applications outside the Play Store.

  • Installing applications on Android emulators.

3. What Is an AAB File?

AAB stands for Android App Bundle.

It is a publishing format used to distribute Android applications through Google Play.

Google Play processes the AAB and generates optimized APKs for different devices and configurations.

Example:

MyReactNativeApp.aab

Uses of AAB

  • Publishing applications on Google Play Store.

  • Delivering optimized application packages.

  • Supporting different device configurations.

  • Managing application distribution through Google Play.

An AAB is not normally installed directly by tapping it on an Android device. It is intended for app store distribution.

4. Difference Between APK and AAB

Feature APK AAB
Full Form Android Package Kit Android App Bundle
Installation Direct installation Normally through Play Store
Main Purpose Testing and distribution Store publishing
File Extension .apk .aab
Google Play Not the preferred upload format Preferred upload format
Device Optimization Package contains installable APK Play generates optimized APKs

Important: For direct Android device installation, generate an APK. For Google Play publishing, generate an AAB.

5. Introduction to EAS Build

EAS Build is a cloud-based service provided by Expo.

It allows developers to compile and sign Android and iOS applications without manually managing the entire native build process.

Using EAS Build, we can:

  • Generate APK files.

  • Generate AAB files.

  • Manage Android signing credentials.

  • Monitor build progress.

  • Download generated application files.

  • Create development, preview, and production builds.

For this tutorial, we will use EAS Build to generate both Android formats.

6. Create a React Native Project

First, create a new Expo project.

Open your terminal and execute:

npx create-expo-app@latest MyAndroidApp --template blank

Open the project:

cd MyAndroidApp

Start the application:

npx expo start

Run the application using Expo Go or an appropriate development environment.

7. Create a Simple Application Screen

Open your App.js file.

Add the following code:

import React from 'react';

import {
  View,
  Text,
  StyleSheet,
} from 'react-native';

export default function App() {

  return (

    <View style={styles.container}>

      <Text style={styles.heading}>
        My Android App
      </Text>

      <Text style={styles.subtitle}>
        Built with React Native and Expo
      </Text>

      <View style={styles.card}>

        <Text style={styles.cardTitle}>
          APK and AAB Build Tutorial
        </Text>

        <Text style={styles.description}>
          My first Android application package.
        </Text>

      </View>

      <Text style={styles.footer}>
        PARAM CLASSES
      </Text>

    </View>

  );

}

const styles = StyleSheet.create({

  container: {
    flex: 1,
    backgroundColor: '#F1F5F9',
    justifyContent: 'center',
    alignItems: 'center',
    padding: 20,
  },

  heading: {
    fontSize: 28,
    fontWeight: 'bold',
    color: '#102A43',
  },

  subtitle: {
    fontSize: 15,
    color: '#64748B',
    marginTop: 8,
  },

  card: {
    backgroundColor: '#FFFFFF',
    padding: 25,
    borderRadius: 15,
    marginTop: 30,
    width: '100%',
    elevation: 4,
  },

  cardTitle: {
    fontSize: 18,
    fontWeight: 'bold',
    color: '#2563EB',
  },

  description: {
    fontSize: 14,
    color: '#64748B',
    marginTop: 10,
  },

  footer: {
    marginTop: 35,
    fontSize: 14,
    fontWeight: 'bold',
    color: '#2563EB',
  },

});

This is our sample application. We will generate its Android APK and AAB files.

8. Install EAS CLI

EAS CLI is the command-line tool used to communicate with Expo Application Services.

Install it globally:

npm install --global eas-cli

Check the installation:

eas --version

Alternatively, you can use EAS CLI through npx:

npx eas-cli@latest --version

9. Create an Expo Account and Login

Open the Expo website:

https://expo.dev/

Create an account if you do not already have one.

Now log in through your terminal:

eas login

Enter your Expo account credentials when prompted.

Check your login:

eas whoami

If your account name appears, authentication is successful.

10. Configure the Project for Android

Open your app.json file.

Configure the Android application identifier.

Example:

{
  "expo": {
    "name": "MyAndroidApp",
    "slug": "my-android-app",
    "version": "1.0.0",
    "android": {
      "package": "com.paramclasses.myandroidapp",
      "versionCode": 1
    }
  }
}

Understanding the Configuration

name: Application display name.

slug: Unique project slug within your Expo account.

version: User-facing application version.

android.package: Unique Android application identifier.

android.versionCode: Internal Android build number.

Choose your own unique Android package identifier before creating your production application. It should not conflict with another application in Google Play.

11. Configure EAS Build

Now initialize EAS Build for your project.

Execute:

eas build:configure

This command creates or configures the eas.json file.

Open the generated eas.json file.

Add the following configuration:

{
  "build": {
    "preview": {
      "distribution": "internal",
      "android": {
        "buildType": "apk"
      }
    },
    "production": {
      "android": {
        "buildType": "app-bundle"
      }
    }
  }
}

Understanding eas.json

preview profile:

This profile generates an APK for direct installation and internal testing.

distribution: internal:

Configures the build for internal distribution.

buildType: apk:

Generates an Android APK file.

production profile:

This profile generates a production Android application bundle.

buildType: app-bundle:

Generates an AAB file.

Keep the preview and production profiles separate so that you can generate both file formats easily.

12. Generate Android APK

Now we will generate an APK file.

Open your project terminal.

Execute:

eas build --platform android --profile preview

EAS Build will begin the build process.

During the first build, it may ask questions about your Android application identifier and signing credentials.

Follow these steps:

  1. Confirm your Android application identifier.

  2. Allow EAS to generate a new Android keystore if you do not already have one.

  3. Confirm the build configuration.

  4. Wait for the build to start.

  5. Open the build URL provided by the CLI.

  6. Monitor the build progress.

When the build is completed, the EAS dashboard will show the generated APK artifact.

Download the APK file.

Example:

MyAndroidApp.apk

You have successfully generated an Android APK.

13. Install APK on an Android Device

Now we will install the generated APK.

Method 1: Direct Installation

  1. Download the APK file.

  2. Transfer it to your Android smartphone.

  3. Open the Downloads folder.

  4. Tap the APK file.

  5. Allow installation from that source if Android requests it.

  6. Press Install.

  7. Wait for installation to finish.

  8. Open your application.

Your React Native application is now installed on your Android device.

Method 2: Install Using ADB

Connect your Android device to your computer using USB.

Enable USB debugging.

Download the APK to your computer.

Execute:

adb devices

Verify that your device is connected.

Now install the APK:

adb install MyAndroidApp.apk

If the installation is successful, ADB displays:

Success

You can now open the application on your phone.

14. Generate Android AAB

Now we will generate an Android App Bundle.

Execute:

eas build --platform android --profile production

EAS Build will start creating the production application bundle.

The production profile uses the app-bundle build type configured in eas.json.

Wait for the build to complete.

Open the EAS build dashboard and download the generated file.

Example:

MyAndroidApp.aab

You have successfully generated an Android AAB.

15. Understanding Android App Signing

Android applications must be digitally signed before distribution.

App signing helps establish the identity of an application publisher and allows Android to verify application updates.

EAS Build can manage Android signing credentials for you.

During the first build, you can allow EAS to generate a new keystore.

A keystore contains the signing key used to sign your application.

Important Signing Rules

  1. Keep your signing credentials secure.

  2. Never share private keystore passwords publicly.

  3. Maintain secure backups of credentials when managing them yourself.

  4. Use the correct signing identity for future application updates.

  5. Never casually replace an existing production signing setup.

If you already have an application published, configure its existing signing credentials instead of creating an unrelated signing identity.

16. View Build History

You can view your previous builds using:

eas build:list

This command displays your project's build history.

You can also open your Expo dashboard:

https://expo.dev/

From the dashboard, you can:

  • View completed builds.

  • Check build status.

  • Read build logs.

  • Download APK files.

  • Download AAB files.

  • Review build configuration details.

17. Upload AAB to Google Play Console

After generating your AAB file, you can prepare it for Google Play Store distribution.

Open:

https://play.google.com/console/

Sign in using your Google Play Developer account.

Follow these steps:

  1. Create your application in Google Play Console.

  2. Complete the required application details.

  3. Open Testing.

  4. Select Internal Testing.

  5. Create a new release.

  6. Upload your generated AAB file.

  7. Add release information.

  8. Review the release details.

  9. Save and publish the testing release.

Google Play Console will process your App Bundle.

After completing the required testing and store setup, you can prepare your production release.

Important: A Google Play Developer account is required for publishing. App review, policy compliance, testing requirements, and store listing requirements must also be completed.

18. Common APK and AAB Build Errors

Error 1: EAS CLI Not Found

Problem: The terminal cannot recognize the eas command.

Solution:

Install EAS CLI:

npm install --global eas-cli

Alternatively, use:

npx eas-cli@latest build --platform android

Error 2: Not Logged In

Problem: EAS cannot identify your Expo account.

Solution:

eas login

Error 3: Missing Android Package Name

Problem: The project does not contain a valid Android application identifier.

Solution:

Add a unique package name in app.json:

{
  "android": {
    "package": "com.paramclasses.myandroidapp"
  }
}

Error 4: Invalid Build Configuration

Problem: EAS cannot read the eas.json configuration.

Solution:

Check your JSON syntax carefully.

Make sure all brackets, commas, and quotation marks are correct.

Error 5: Signing Credentials Problem

Problem: The build fails because the signing credentials are missing or incorrect.

Solution:

Review the Android credentials in your Expo project.

Use the correct existing keystore for an already published application.

Error 6: Build Failed

Problem: The cloud build fails during compilation.

Solution:

Open the build logs in the Expo dashboard.

Check dependency compatibility, native configuration, Gradle errors, and package versions.

Fix the reported problem and start another build.

19. APK vs AAB: Which One Should You Use?

Use APK when:

  • You want to install an application directly.

  • You want to share an application with testers.

  • You want to test an application on a physical Android device.

  • You want to distribute a standalone installable package.

Use AAB when:

  • You want to publish on Google Play.

  • You want Google Play to generate optimized APKs.

  • You are preparing a production release.

  • You want to use Play Store distribution features.

For most modern Google Play publishing workflows, AAB is the preferred format.

20. Final Project Outcome

After completing this tutorial, you will know how to:

  • Create a React Native application.

  • Install and configure EAS CLI.

  • Connect your Expo account.

  • Configure Android application identifiers.

  • Create APK and AAB build profiles.

  • Generate an APK using EAS Build.

  • Install APK on an Android smartphone.

  • Generate a production AAB.

  • Understand Android signing credentials.

  • Prepare an AAB for Google Play Console.

21. Conclusion

Generating APK and AAB files is an important part of React Native application development.

APK files are useful for direct installation and testing, while AAB files are designed for Google Play distribution.

With Expo EAS Build, developers can generate both formats through a simple command-line workflow.

After completing this tutorial, you can take your React Native application from development to Android distribution.

Practice Task: Create a React Native application with your own app name, icon, splash screen, and package identifier. Generate both an APK and an AAB file and test the APK on your Android smartphone.

22. Frequently Asked Questions

Q1. What is an APK file?

APK is an Android application package that can be installed directly on compatible Android devices.

Q2. What is an AAB file?

AAB is an Android App Bundle used primarily for publishing applications through Google Play.

Q3. Which file should I use for Google Play Store?

Use the AAB format for new Google Play application publishing workflows.

Q4. Can I install an AAB file directly on my phone?

An AAB is not a normal directly installable package. Use an APK for direct installation or deliver the bundle through Google Play.

Q5. Can I generate APK without Android Studio?

Yes. With Expo EAS Build, you can generate an APK through the cloud without manually building the native Android project in Android Studio.

Q6. What is EAS Build?

EAS Build is Expo's cloud build service for generating signed Android and iOS application binaries.

Q7. What is a keystore?

A keystore stores signing credentials used to digitally sign Android applications.

Q8. Can I generate both APK and AAB from one React Native project?

Yes. Configure separate build profiles in eas.json and run the appropriate EAS Build command for each format.

←
Post 36 of 39
→