# Where Is the Android Native Code Located in the React Native Repository?

> Discover the exact location of Android native code in the React Native repository. Find the Java Kotlin framework, C++/JNI native layer, and Gradle build files in the ReactAndroid directory.

- Repository: [Meta/react-native](https://github.com/facebook/react-native)
- Tags: internals
- Published: 2026-02-25

---

**The Android native code in React Native is located primarily in the `packages/react-native/ReactAndroid` directory, which contains the Java/Kotlin framework, C++/JNI native layer, and Gradle build configuration.**

The React Native repository on GitHub organizes its platform-specific implementations into dedicated packages. If you are looking for the **Android native code located in the React Native repository**, you will find the bulk of the implementation inside the `ReactAndroid` package. This directory houses everything from the bridge lifecycle managers to the compiled C++ libraries that power the JavaScript engine integration.

## Core Directory Structure: `packages/react-native/ReactAndroid`

The `ReactAndroid` directory is the single source of truth for Android-specific native functionality. According to the React Native source code, this folder is organized into four primary areas:

- **Java/Kotlin framework** – UI managers, bridge infrastructure, module system, and activity helpers
- **C++/JNI native layer** – Bridge to the Java side, Yoga layout engine, Fabric renderer, and TurboModules
- **Build scripts and Gradle integration** – Gradle module configuration, CMake files, and ProGuard rules
- **Resources** – XML layouts, style files, and string tables packaged with the AAR

### Java and Kotlin Framework Layer

The Java and Kotlin source files expose React Native to Android applications through a set of manager classes. In [`packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java`](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java), the `ReactInstanceManager` class orchestrates the bridge lifecycle, JavaScript executor, and UI manager creation.

Key entry points in this layer include:

- [`ReactInstanceManager.java`](https://github.com/facebook/react-native/blob/main/ReactInstanceManager.java) – Manages the bridge lifecycle and JS executor
- [`ReactNativeHost.java`](https://github.com/facebook/react-native/blob/main/ReactNativeHost.java) – A convenience wrapper used by the app's `Application` class
- [`ReactApplication.java`](https://github.com/facebook/react-native/blob/main/ReactApplication.java) – Interface that an `Application` must implement
- [`ReactRootView.java`](https://github.com/facebook/react-native/blob/main/ReactRootView.java) – The native view that hosts the React tree

### C++ and JNI Native Layer

The heavy lifting for React Native on Android occurs in the C++ libraries compiled via JNI. The entry point for native method registration is [`packages/react-native/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp`](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp), which loads when the library initializes.

Critical JNI components include:

- [`OnLoad.cpp`](https://github.com/facebook/react-native/blob/main/OnLoad.cpp) – Registers native methods on library load
- [`JavaScriptExecutorHolder.h`](https://github.com/facebook/react-native/blob/main/JavaScriptExecutorHolder.h) – Abstracts the JS engine (Hermes, V8, JSC)
- [`YGJNI.h`](https://github.com/facebook/react-native/blob/main/YGJNI.h) – JNI bridge for the Yoga layout engine located in `src/main/jni/first-party/yogajni/jni/`

### Build System Integration

The Android native code is assembled into an AAR using Gradle and CMake. The `packages/react-native/ReactAndroid/build.gradle.kts` file defines the module, its dependencies, and invokes the CMake build.

Key build files:

- `build.gradle.kts` – Gradle module definition for the AAR
- [`src/main/jni/CMakeLists.txt`](https://github.com/facebook/react-native/blob/main/src/main/jni/CMakeLists.txt) – Top-level CMake file that compiles native code and links third-party libraries

## Practical Integration Examples

### Minimal Android Integration (Kotlin)

To integrate React Native into an existing Android application, implement `ReactApplication` in your `Application` class:

```kotlin
// MyApplication.kt
class MyApplication : Application(), ReactApplication {
  private val mReactNativeHost = object : ReactNativeHost(this) {
    override fun getUseDeveloperSupport() = BuildConfig.DEBUG
    override fun getPackages() = listOf(
        MainReactPackage(),
        // add other packages here
    )
    override fun getJSMainModuleName() = "index"
  }

  override fun getReactNativeHost(): ReactNativeHost = mReactNativeHost
}

```

### Launching a React View from an Activity

Use `ReactActivity` or manually manage a `ReactRootView`:

```kotlin
class MainActivity : ReactActivity() {
  // ReactActivity already sets up the ReactRootView.
  // If you need a custom setup, you can do:
  override fun getMainComponentName() = "MyApp"

  // Optional: provide a custom ReactInstanceManager
  override fun getReactInstanceManager(): ReactInstanceManager {
    return (application as MyApplication).reactNativeHost.reactInstanceManager
  }
}

```

### Accessing a Native Module from JavaScript

Create a native module by extending `ReactContextBaseJavaModule`:

```java
// MyNativeModule.java
public class MyNativeModule extends ReactContextBaseJavaModule {
  MyNativeModule(ReactApplicationContext ctx) { super(ctx); }

  @Override
  public String getName() { return "MyNativeModule"; }

  @ReactMethod
  public void showToast(String msg) {
    Toast.makeText(getReactApplicationContext(), msg, Toast.LENGTH_SHORT).show();
  }
}

```

Then call it from JavaScript:

```javascript
// MyComponent.js
import {NativeModules} from 'react-native';
NativeModules.MyNativeModule.showToast('Hello from JS!');

```

## Summary

- The **Android native code** for React Native is centralized in `packages/react-native/ReactAndroid`.
- The **Java/Kotlin framework** exposes native functionality through `ReactInstanceManager`, `ReactNativeHost`, and `ReactRootView`.
- The **C++/JNI layer** handles the bridge, layout engine, and JS execution via files like [`OnLoad.cpp`](https://github.com/facebook/react-native/blob/main/OnLoad.cpp) and [`JavaScriptExecutorHolder.h`](https://github.com/facebook/react-native/blob/main/JavaScriptExecutorHolder.h).
- **Build configuration** relies on `build.gradle.kts` and [`CMakeLists.txt`](https://github.com/facebook/react-native/blob/main/CMakeLists.txt) to compile the AAR and native libraries.
- Sample integration code demonstrates how [`MainApplication.kt`](https://github.com/facebook/react-native/blob/main/MainApplication.kt) and [`MainActivity.kt`](https://github.com/facebook/react-native/blob/main/MainActivity.kt) wire these components together.

## Frequently Asked Questions

### What is the exact path to the Android native code in React Native?

The Android native code is located at `packages/react-native/ReactAndroid` in the React Native repository. This directory contains the Java/Kotlin source files under `src/main/java/`, C++ JNI code under `src/main/jni/`, and build scripts including `build.gradle.kts` and [`CMakeLists.txt`](https://github.com/facebook/react-native/blob/main/CMakeLists.txt).

### Which file manages the React Native bridge lifecycle on Android?

The [`ReactInstanceManager.java`](https://github.com/facebook/react-native/blob/main/ReactInstanceManager.java) file located at [`packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java`](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java) manages the bridge lifecycle. It orchestrates the JavaScript executor, UI manager creation, and communication between JavaScript and native Android code.

### Where is the C++ JNI code located in React Native's Android implementation?

The C++ JNI code resides in `packages/react-native/ReactAndroid/src/main/jni/`. Key files include [`react/jni/OnLoad.cpp`](https://github.com/facebook/react-native/blob/main/react/jni/OnLoad.cpp) for native method registration, [`react/jni/JavaScriptExecutorHolder.h`](https://github.com/facebook/react-native/blob/main/react/jni/JavaScriptExecutorHolder.h) for JS engine abstraction, and [`first-party/yogajni/jni/YGJNI.h`](https://github.com/facebook/react-native/blob/main/first-party/yogajni/jni/YGJNI.h) for the Yoga layout engine bridge.

### How do I integrate React Native into an existing Android app using these native files?

To integrate React Native, implement the `ReactApplication` interface in your `Application` class using `ReactNativeHost` as shown in [`private/helloworld/android/app/src/main/java/com/helloworld/MainApplication.kt`](https://github.com/facebook/react-native/blob/main/private/helloworld/android/app/src/main/java/com/helloworld/MainApplication.kt). Then create an Activity that extends `ReactActivity` or manually manages a `ReactRootView`, referencing the `ReactInstanceManager` from your application class to coordinate the native bridge.