> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-gr001-partner-ingestion-limits.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Android Build Configuration

> Configure Android build settings and add required dependencies for the MoEngage React Native SDK.

## Prerequisites

Before you continue, make sure you have:

* Installed the [`react-native-moengage`](/developer-guide/react-native-sdk/sdk-integration/react-native/sdk-installation/framework-dependency) package in your project.
* React Native `0.60` or later. Older versions do not support autolinking and require manual native linking.
* Android `compileSdkVersion` `34` or later in `android/build.gradle`.

## Configuring Build Settings

<Warning>
  The MoEngage SDK depends on the `lifecycle-process` library, which in turn depends on `androidx.startup:startup-runtime`. To keep SDK features working:

  * Do not remove the `InitializationProvider` component from your `AndroidManifest.xml`.
  * If you add other initializers that use `startup-runtime`, also add the initializer for `lifecycle-process`.
  * See the [Lifecycle 2.4.0 release notes](https://developer.android.com/jetpack/androidx/releases/lifecycle#2.4.0) for instructions on adding the initializer.
</Warning>

## Add AndroidX Libraries

The SDK depends on a few AndroidX libraries for its functioning. Choose one of the following approaches to add them — either enable the flag in `package.json` (recommended) or add the dependencies directly to your `build.gradle` file.

### Configure in the package.json File

<Info>
  * Setting `includeAndroidXRequiredLibraries` to `true` automatically adds the AndroidX libraries that the SDK uses as dependencies.
  * **Required AndroidX libraries:** The MoEngage SDK requires the following core AndroidX dependencies:
    * `androidx.core:core`
    * `androidx.appcompat:appcompat`
    * `androidx.lifecycle:lifecycle-process`
  * Before enabling this flag, check whether your application's native Android project (`build.gradle`) already includes compatible versions of these libraries. If it does, you may not need to pull them in again, which helps prevent version conflicts or duplicate dependency errors during the build process.
</Info>

File — `package.json`

<CodeGroup>
  ```json JSON theme={null}
  {
      "moengage": {
          "includeAndroidXRequiredLibraries": true
      }
  }
  ```
</CodeGroup>

### Configure in the Gradle File

Skip this section if you set `includeAndroidXRequiredLibraries: true` in `package.json` above.

Path — `android/app/build.gradle` (use `build.gradle` for Groovy or `build.gradle.kts` for Kotlin build scripts).

<CodeGroup>
  ```groovy Groovy theme={null}
  dependencies {
      ...
      implementation("androidx.core:core:1.9.0")
      implementation("androidx.appcompat:appcompat:1.4.2")
      implementation("androidx.lifecycle:lifecycle-process:2.7.0")
  }
  ```

  ```kotlin Kotlin theme={null}
  dependencies {
      ...
      implementation("androidx.core:core:1.9.0")
      implementation("androidx.appcompat:appcompat:1.4.2")
      implementation("androidx.lifecycle:lifecycle-process:2.7.0")
  }
  ```
</CodeGroup>

<Note>
  Use the versions shown or higher. Check [Google Maven](https://maven.google.com) for the latest stable releases.
</Note>

## Verify the Build

After adding the dependencies, run the following command from your project root to confirm that the MoEngage and AndroidX dependencies are resolved correctly:

<CodeGroup>
  ```bash Bash theme={null}
  cd android && ./gradlew :app:dependencies | grep moengage
  ```
</CodeGroup>

If the command returns one or more MoEngage entries, the dependencies are linked.

## Feature Modules (Optional)

To include optional modules from the MoEngage SDK based on your feature requirements, use the provided flags. By default, these modules are not included in your project.

Configure feature modules by adding a `moengage` key to the root of your project's `package.json` file. Set a flag to `true` to download and link the native dependencies for that module; omit it or set it to `false` to exclude the module.

File — `package.json`

<CodeGroup>
  ```json JSON theme={null}
  {
      "moengage": {
          "richNotification": true,
          "encryption": true,
          "pushAmp": true,
          "hmsPushkit": true,
          "deviceTrigger": true
      }
  }
  ```
</CodeGroup>

The following table describes each flag:

| Flag               | Enables                    |
| ------------------ | -------------------------- |
| `richNotification` | Push Templates             |
| `encryption`       | Add-On Security            |
| `pushAmp`          | Push Amplification         |
| `hmsPushkit`       | HMS PushKit                |
| `deviceTrigger`    | Device Triggered campaigns |

### Documentation for Optional Feature Flags

<Note>
  The following links cover the Android native SDK. The behavior is equivalent in the React Native SDK.
</Note>

* [Push Templates](/developer-guide/android-sdk/push/optional/push-templates)
* [Add-On Security](/developer-guide/android-sdk/sdk-integration/advanced-or-optional/add-on-security)
* [Push Amplification](/developer-guide/android-sdk/push/optional/push-amplification)
* [HMS PushKit](/developer-guide/android-sdk/push/optional/push-amp-plus/configuring-hms-push-kit)
* [Device Triggered](/developer-guide/android-sdk/push/optional/device-triggered)
