Android Manifest Merger Failed — Find the First Real Conflict

Manifest merger failed is the wrapper, not the diagnosis. Read the first concrete conflict underneath it: identify the element/attribute, the two source manifests and values, then use manifest priority to decide what the final app is supposed to contain. Only then apply the narrowest merger rule or dependency/configuration fix.

Android · Gradle · Manifest Mergertools:replace · priority · variantsLast reviewed Sep 27, 2026
🎯 This guide matches when:
Gradle/Android Studio reports Manifest merger failed or a process...MainManifest/process...Manifest task failure.The output names a conflicting manifest element/attribute, two values, source locations, or suggests a tools: marker.The project combines app, build-type/flavor and library manifests into a variant-specific final manifest.
Follow the first concrete conflict
Same attribute, different values →Trace both source manifests and decide the intended final value before considering tools:replace.Conflict comes from a library →Decide whether app priority should override it, the dependency/config should change, or the library requirement is intentional.Whole element/node conflict →Use node-level merger semantics only after identifying which node should survive.Only debug/release/flavor fails →Inspect that variant's manifest sources and placeholders, not just src/main.Error is actually AAPT2/AAR metadata →Leave manifest merging and use the resource-link or AAR requirement branch instead.
Difficulty: ModerateRisk: Medium if overrides hide library requirements
🔎 Quick Check — read the first conflict, not the final wrapper
./gradlew :app:tasks --all

Find the manifest-processing task for the variant that actually failed, then rerun that exact task with --info if you need more CLI evidence. Task names are generated from modules/variants and can vary across projects and Android Gradle Plugin versions, so do not blindly copy processDebugMainManifest from another project. Capture the first conflict block that names the manifest locations, element/attribute and competing values. Android Studio's Merged Manifest view is often faster for tracing where each value came from.

Guardrail: Never add tools:replace until you know which manifest supplied each conflicting value and which value the final app is supposed to keep.

Verify: You can name the exact element/attribute, both source manifests, both values and the failing variant.

Did you identify both sides of the conflict?
ADSENSE · reserved slot after the first useful step

Diagnostic flow — conflict → sources → priority → intended result

1
Wrapper
Which manifest-processing task/variant failed?
2
First concrete conflict
Which element or attribute has incompatible values?
3
Source manifests
Which app/flavor/build-type/library manifest supplied each side?
4
Priority + intent
Which value/node should the final variant actually keep?
5
Narrow remediation
Fix the source/config or apply the smallest justified merger marker, then inspect the final merged manifest.

Fix #2 — attribute conflict: determine the intended value first

Android's manifest merger uses source-set priority. For a typical variant, priority runs from the variant-specific manifest through build type and product flavors to src/main, then library dependencies; when multiple flavor dimensions exist, their declared dimension order also affects priority. Multiple libraries have their own dependency-order priority. A conflict means the default merge rules cannot safely choose between values.

Before adding a marker, ask whether the app genuinely intends to override the lower-priority value. For example, a library may declare a component property for a reason; overriding it without understanding that contract can produce a build that merges but behaves incorrectly.

If the higher-priority manifest intentionally owns the final value, a narrowly scoped tools:replace="android:…" can be appropriate. The higher-priority element must also declare the replacement value you actually intend to ship; the marker is not a magic “accept mine” switch without a deliberate final value. But a marker is not proof that the chosen value is semantically correct—it only tells the merger how to resolve the conflict. The marker belongs on the higher-priority element and requires the tools namespace.

Verify: Merged Manifest shows the intended final attribute and its source/override marker for the exact failing variant.

Fix #3 — when a library supplies the conflicting value

Do not edit files under Gradle's dependency cache. First identify the library and version, then decide whether the right repair is an app-level intentional override, a dependency upgrade/downgrade supported by the project, removal of a duplicate/obsolete dependency, or configuration required by that library.

./gradlew :app:dependencies ./gradlew :app:dependencyInsight --dependency <library-name> --configuration debugRuntimeClasspath

Use the configuration corresponding to the failing variant. A transitive library may be the source even when it is absent from the top-level dependencies block.

Verify: You can trace the manifest source to a specific dependency/version and explain why the app should override it—or why the dependency itself should change.

Fix #4 — whole-node conflicts: use tools:node deliberately

Markers such as tools:node="remove", replace, merge, strict and tools:selector can operate more broadly than replacing one attribute. tools:selector can scope a marker to a particular lower-priority library rather than every matching node. The selector value identifies the lower-priority library by its manifest package name, so confirm that package/source before using it. Keep the scope as narrow as the conflict allows. Use them only when the desired final component/node is unambiguous.

Removing a provider, service, receiver, permission, uses-feature or metadata node just to make the build pass can disable library initialization/runtime behavior or change the app's permissions and device availability. Check the owning library's integration documentation before removing its node.

Verify: The Merged Manifest contains exactly the intended node set and required library components remain present. For permissions/features/components with packaging consequences, also inspect the built artifact or relevant Play/device behavior when appropriate—the merge succeeding is not the only correctness gate.

Fix #5 — debug/release/flavor-only conflicts

The final manifest is variant-specific. Inspect src/main, product-flavor, build-type and variant manifests plus manifest placeholders. A fix made only in main may not explain why release fails while debug succeeds.

Also verify placeholder values supplied by Gradle for that variant. Manifest placeholders can be configured per default config/flavor/build setup and substituted into the final manifest; two source manifests that look compatible can therefore produce different effective values after substitution. Inspect the resolved value in the Merged Manifest, not only the literal ${placeholder} in source.

Do not confuse a merge conflict with a platform manifest requirement. For example, android:exported has platform semantics for components with intent filters on modern target SDKs. If the build complains that a required attribute is missing rather than showing two competing manifest values, first satisfy the platform/component requirement; do not invent a tools:replace conflict that is not there.

Verify: Inspect the Merged Manifest for the same build variant, then rebuild that exact variant—not merely a different debug task that already worked.

Fix #6 — stop if the first concrete error belongs to another build stage

If the actionable line is Android resource linking failed, missing android:attr, malformed XML/resource syntax, or checkDebugAarMetadata platform requirements, manifest markers are the wrong tool. Follow the build stage that produced the first concrete error.

Verify: Your remediation targets manifest composition semantics, not a downstream resource-link or dependency-metadata error.

What not to do

Do not paste tools:replace from the error suggestion before identifying both source values and intended winner.Do not add broad tools:node="replace"/remove" markers when one attribute is the actual conflict.Do not edit a library manifest inside Gradle caches.Do not inspect only src/main/AndroidManifest.xml when the failure is variant-specific.Do not remove providers/services/receivers/permissions/features without checking the library runtime, security and device-availability consequences.Do not use a global marker when a correctly identified tools:selector can safely target the specific lower-priority library that causes the conflict.Do not copy a generated manifest-processing task name from a tutorial; resolve and rerun the task for your own failing module/variant.Do not treat a missing platform-required attribute such as android:exported as though it were automatically a two-value merge conflict.Do not confuse AAPT2 resource linking or AAR metadata failures with manifest-merger semantics.

Still seeing Manifest merger failed?

Escalate with the merger evidence, not only the wrapper line. The useful report shows exactly what the merger was unable to reconcile.

Before escalating, capture:exact failing Gradle manifest task and variantfirst concrete conflict block beneath Manifest merger failedelement/attribute and both competing valuesboth source manifest paths and dependency/version if a library owns onerelevant flavor/build-type/placeholdersMerged Manifest result or merger report after the attempted fix, including the blame/source of the final valueresolved manifest-placeholder values for the failing variant when placeholders are involvedexact marker/configuration change and why that final value is intended

Official references

Still stuck? Ask the community

Share the conflict block, variant, source manifests and a redacted Merged Manifest excerpt.

Keep it safe: redact signing data, private package names/URLs, credentials, tokens and proprietary source paths.
Powered by GitHub DiscussionsSign in with GitHub to comment. Reading comments does not require sign-in.

Loading community discussion…