Fixing the 'Manifest merger failed' Error in Android Studio

intermediate๐Ÿ“ฑ Android2026-06-08| Android Studio (Arctic Fox through Hedgehog), Gradle 7.0+, Windows/macOS/Linux

Error Message

Error: Manifest merger failed with multiple errors, see logs
#android-studio#gradle#manifest#build-error

The ProblemIt usually happens right after you've added a shiny new library or bumped your Gradle versions. You hit 'Build' and instead of a running app, you get a generic, frustrating message in the Build Output window:

Error: Manifest merger failed with multiple errors, see logs

This error is essentially a 'check engine' light. It tells you there's a problem but hides the details. In short, your main AndroidManifest.xml and a library's manifest have conflicting instructions. Gradle doesn't know which one to pick, so it gives up.

Phase 1: Finding the Hidden Error LogsDon't waste time staring at the generic error output hoping it will reveal more. You need to dig into the actual conflict details. Here are the two most effective ways to find them.

Method A: The Merged Manifest Tab- Open your AndroidManifest.xml file in Android Studio.- Look at the bottom of the editor window. Click the Merged Manifest tab next to 'Code' and 'Design'.- Wait a few seconds. Android Studio will highlight the conflicts in red. Click the errors at the bottom to see exactly which attributes are clashing.### Method B: The Terminal ApproachSometimes the Merged Manifest tab stays blank or fails to load. When that happens, the terminal is your best friend. Open the terminal at the bottom of Android Studio and run:

./gradlew assembleDebug --stacktrace

Scan the output for a section labeled Suggestion:. This often gives you a copy-paste solution to fix the conflict.

Phase 2: Common Scenarios and Fixes### Scenario 1: Attribute ConflictsThis is the primary culprit. It happens when two manifests define the same attribute with different values. For instance, the Firebase SDK might set android:allowBackup="true", but your company's security policy requires false.

The Fix: Use tools:replace to tell Gradle that your app's manifest is the source of truth.

  • First, add the tools namespace to your <manifest> tag:<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">- Next, add tools:replace to your <application> tag. List the conflicting attributes, separated by commas:``` ...

### Scenario 2: minSdkVersion MismatchIf your project targets API 21 but you import a library that requires API 26, the build will fail immediately. Your logs will show a message like: *"uses-sdk:minSdkVersion 21 cannot be smaller than version 26 declared in library..."*
**The Fix:** You have two choices here.
- **The Safe Route:** Update your `build.gradle` (Module: app) to match the library's `minSdkVersion`. This ensures total compatibility.- **The Risky Route:** If you know the library won't be used on older devices, force the merger:```
<uses-sdk tools:overrideLibrary="com.example.conflicting.library"/>

Scenario 3: Missing 'android:exported' (Android 12+)Starting with Android 12 (API 31), every Activity, Service, or Receiver with an <intent-filter> must explicitly state android:exported="true" or false. If a legacy library forgets this, your build will crash.

The Fix: Check the logs for "Element activity#... is missing android:exported attribute". You'll need to manually declare that specific component in your own manifest and add the android:exported tag to override the library's faulty definition.

Phase 3: VerificationAfter applying a fix, don't just try to run the app again. Clear out the old artifacts first:

  • Navigate to Build > Clean Project.- Select Build > Rebuild Project.- Check the Merged Manifest tab one last time. The red text should be gone.Still stuck? Look for manifest-merger-debug-report.txt inside your build/outputs/logs/ folder. It contains a line-by-line log of every decision the merger made during the build process.

Related Error Notes