Skip to main content

Android Installation and Android App Development Guide

This section explains how to set up the Android development environment and build processes for your React Native application.

Prerequisites

  • Java Development Kit (JDK): OpenJDK 17 (openjdk-17-jdk) must be installed on your system for Android development. Version 17 or higher is recommended.
  • Android Studio: Install Android Studio to run Android SDK and emulators. Use the Android SDK manager to install necessary packages.
  • Node.js and npm: npm comes with Node.js. It is recommended to download and install the LTS (Long Term Support) version of Node.js from https://nodejs.org/en/download.
  • Yarn: Yarn is used to manage dependencies within the project. Install it globally with npm install -g yarn.
  • Project Dependencies: To install required modules, run the following command in your project directory terminal:
    yarn install

About the android-cli.js File

The android-cli.js file in your project root is a custom command line helper tool designed to facilitate your Android mobile development workflows.

CLI Interface:

Welcome to the Android Mobile CLI!
Do you want to (r)un, (b)uild, (c)lean, check (v)ersion, or (o)pen existing build?

(r)un Option

Used to run the app on a connected device or emulator.

  • Development Mode (dev):
    yarn react-native run-android --mode=developmentdebug --appId com.wastelog.producers.development
  • Production Mode (prod):
    yarn react-native run-android --mode=productiondebug --appId com.wastelog.producers

To run the app, follow these steps in your terminal:

  1. Run the command node android-cli.js
  2. Press (r) to select the run option
  3. To watch changes and view on emulator or connected physical device, open another terminal and run yarn start
  4. If the app does not load initially, press r in the metro terminal to reload

(b)uild Option

Generates binary files in APK or AAB format.

The following screen will appear during the build:

Current development version:
Version Code: 215
Version Name: 3.32

Do you want to increment the version code? (y/n): y
Do you want to update the version name? (y/n): n
  • Version Code acts as a unique ID for Android and must always increase with each build.
  • When moving to a production release, the version should be updated, and the Version Name must be incremented.
  • The version number used in the project should also be updated manually by searching the iOS config files under version info.
  1. Pre-build Cleanup:
    Clean the following folders manually or using Node.js fs.rmSync:
    rm -rf android/.gradle
    rm -rf android/.kotlin
    rm -rf android/build
    rm -rf android/app/.cxx
    rm -rf android/app/build
  2. Build Process:
  • dev mode + apk:
    cd android && ./gradlew clean assembleDevelopmentRelease
  • prod mode + apk:
    cd android && ./gradlew clean assembleProductionRelease
  • dev mode + aab:
    (Version info in build.gradle is updated via script as described above)
    cd android && ./gradlew clean bundleDevelopmentRelease
  • prod mode + aab:
    (Version info in build.gradle is updated via script as described above)
    cd android && ./gradlew clean bundleProductionRelease

(c)lean Option

Thoroughly cleans node_modules and native cache folders:

yarn react-native-clean-project

(o)pen Option

Opens the built output in the operating system's file explorer.

  • Windows:
    explorer "android\app\build\outputs\apk\developmentRelease"
  • macOS:
    open "android/app/build/outputs/apk/developmentRelease"
  • Linux:
    xdg-open "android/app/build/outputs/apk/developmentRelease"

(v)ersion Option

Checks the current version information. (Shell command is not run; the android/app/build.gradle file is read and version info is extracted via regex.)


With this guide, you can set up your Android development environment and build and run your application.

Play Store aab File Upload

To upload your aab file for your test release in Google Play Console, follow the steps below:

  1. Go to Test & Release > Testing > Internal Testing
  2. Click the "Create new Release" button

The following image shows this stage:

Play Store Upload Step 1

  1. Drag and drop your aab file into the upload area
  2. Click "Next" and after filling in the required information, use the "Release" button to publish the release

After the upload completes, your release will be available for internal testers to test.

The image below illustrates this step:

Play Store Upload Step 2

Adding Play Store Testers

To add testers to your development projects via the Google Play Console, follow these steps:

  • Navigate to Test & Release > Testing > Internal Testing
  • Find the Join link on the web and share it with your testers
  • Testers can join the testing program using this link

Below is an image illustrating these steps:

Play Store Tester Register