Module 11: Build & Deployment

Build and deploy React Native applications to app stores with best practices.

Back to Course|5 hours|Advanced

Build & Deployment

Build and deploy React Native applications to app stores with best practices.

Progress: 0/4 topics completed0%

Select Topics Overview

Android Build Process

Learn to build and package React Native applications for Android platform including APK and AAB generation

Content by: Ronak Macwan

React Native Developer

Connect

Android Build Setup

Configure Android build environment, signing keys, and build variants for development and production releases.

Build Configuration

Set up build.gradle files, ProGuard rules, and app signing for secure Android app distribution.

Android Build Example

Code Example
// android/app/build.gradle
android {
    compileSdkVersion 33
    buildToolsVersion "33.0.0"

    defaultConfig {
        applicationId "com.yourapp.reactnative"
        minSdkVersion 21
        targetSdkVersion 33
        versionCode 1
        versionName "1.0.0"
        multiDexEnabled true
    }

    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
        }
    }

    buildTypes {
        debug {
            signingConfig signingConfigs.debug
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            shrinkResources true
        }
    }

    bundle {
        language {
            enableSplit = true
        }
        density {
            enableSplit = true
        }
        abi {
            enableSplit = true
        }
    }
}

// gradle.properties
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=*****
MYAPP_UPLOAD_KEY_PASSWORD=*****

# Build commands
# Debug APK: ./gradlew assembleDebug
# Release APK: ./gradlew assembleRelease
# Release AAB: ./gradlew bundleRelease
Swipe to see more code

๐ŸŽฏ Practice Exercise

Test your understanding of this topic:

Ready for the Next Module?

Continue your learning journey and master the next set of concepts.

Continue to Module 12