React Native Android build fails with Manifest merger error: `allowBackup` conflict

Issue I Faced

While building my React Native project, the Gradle build failed at the manifest processing step:

Task :app:processDevDebugMainManifest FAILED
/home/.../android/app/src/debug/AndroidManifest.xml:14:162-188 Error:
Attribute application@allowBackup value=(false) from AndroidManifest.xml
is also present at AndroidManifest.xml value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to <application> element

The error occurs when multiple manifests (main, debug, flavor, or library manifests) specify different values for the same attribute.


Root Cause

The allowBackup attribute was set differently across manifests (e.g., true in main, false in debug). When Android merges all manifests, it doesn’t know which one to keep, causing the merge to fail.

What was getting overriden

# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false

How I Solved It

  1. Open android/app/src/main/AndroidManifest.xml.
  2. Add the tools namespace to the <manifest> tag if not already present:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools">
Add tools:replace="android:allowBackup" to your <application> tag:

<application
    android:name=".MainApplication"
    android:allowBackup="false"
    tools:replace="android:allowBackup"
    ... >

Clean and rebuild the project

cd android && ./gradlew clean && cd ..

npm run android

After this, the build succeeded, and the APK installed properly.

Tips for Others:
Manifest merger errors usually come from conflicting attributes across main, flavor, and library manifests.

  • Use tools:replace to explicitly override values.

  • Always clean the build after fixing manifest issues.

3 Likes