Skip to main content

Android Development Setup

Set up your development environment to build and run React Native applications on Android devices and emulators.

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js (^20.19.4 || ^22.13.0 || ^24.3.0 || >= 25.0.0)
  • Java Development Kit (JDK) 17 or newer
  • Android Studio
  • Android SDK

Installing Android Studio

1

Download Android Studio

Download and install Android Studio from developer.android.com.
2

Install Android SDK

During installation, make sure the following components are selected:
  • Android SDK
  • Android SDK Platform
  • Android Virtual Device (AVD)
3

Configure SDK Manager

Open Android Studio, go to Settings > Appearance & Behavior > System Settings > Android SDK.Install the following SDK tools:
  • Android SDK Platform 35 or higher
  • Android SDK Build-Tools
  • Android SDK Platform-Tools
  • Android SDK Command-line Tools

Environment Variables

Configure your environment variables to point to the Android SDK:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools

Gradle Configuration

React Native uses Gradle as its build system. The main configuration is in android/build.gradle:
buildscript {
    ext {
        buildToolsVersion = "35.0.0"
        minSdkVersion = 24
        compileSdkVersion = 35
        targetSdkVersion = 35
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:8.12.0")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
    }
}

Key Gradle Properties

Configure your gradle.properties file:
# Use AndroidX library
android.useAndroidX=true

# Enable Hermes JavaScript engine
hermesEnabled=true

# Enable New Architecture
newArchEnabled=false

Android Manifest Configuration

Your AndroidManifest.xml requires specific permissions and configurations:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    
    <application
        android:name=".MainApplication"
        android:allowBackup="false"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustResize"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

MainApplication Configuration

Implement the ReactApplication interface in your main application class:
package com.yourapp

import android.app.Application
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {

    override val reactNativeHost: ReactNativeHost =
        object : DefaultReactNativeHost(this) {
            override fun getPackages(): List<ReactPackage> =
                listOf(
                    // Add your packages here
                )

            override fun getJSMainModuleName(): String = "index"

            override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

            override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
            override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
        }

    override val reactHost: ReactHost
        get() = DefaultReactHost.getDefaultReactHost(applicationContext, reactNativeHost)

    override fun onCreate() {
        super.onCreate()
        SoLoader.init(this, false)
    }
}

Running on Android

1

Start Metro bundler

npx react-native start
2

Run on device or emulator

npx react-native run-android

Common Build Issues

Gradle Sync Failed

If Gradle sync fails, try:
cd android
./gradlew clean
cd ..

SDK Version Mismatch

Ensure your compileSdkVersion matches the installed SDK:
android {
    compileSdkVersion 35
    
    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 35
    }
}

Native Modules Cache

Clear React Native cache:
npx react-native start --reset-cache

Next Steps

Build docs developers (and LLMs) love