Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Manifest merger fails on application@appComponentFactory after adding a library

ErrorManifest merger failed : Attribute application@appComponentFactory

Short answer

Two manifests set appComponentFactory to different values, usually one from AndroidX and one from an old support-library dependency. The right fix is to update or replace the old dependency. Jetifier can convert it at build time. Do not hide it with a merge marker before you know which library is old.

  • Applies to Android Gradle Plugin 8.x, Gradle 8.x, AndroidX libraries
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open the merger report. It names both manifests that set the attribute, so you know which library is the old one.

    grep -n "appComponentFactory" app/build/outputs/logs/manifest-merger-debug-report.txt
  2. 2Match what you see, then jump to its fix

    1. 1One value comes from an androidx artifact and the other from a com.android.support artifactA dependency still uses the old support libraryFix
    2. 2The library has no AndroidX release, and the error comes from its manifestYou cannot update the library right nowFix

What does the error look like?

  • Manifest merger failed : Attribute application@appComponentFactory

Cause 1 of 2

A dependency still uses the old support library

1Check

Print the dependency tree and look for a library that pulls in the old support artifacts.

./gradlew :app:dependencies --configuration debugRuntimeClasspath | grep -i "com.android.support"

2Fix

Update that library to a release that uses AndroidX, or replace it. The mapping tables show the AndroidX equivalent of each support artifact.

dependencies {
    implementation("com.example:some-library:2.0.0") // an AndroidX-based release
}

3Verify

Rebuild. The merger error is gone and the dependency search prints nothing.

./gradlew :app:assembleDebug

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 2

You cannot update the library right now

1Check

Check whether the project already has Jetifier on, and whether Build Analyzer says it is needed.

grep -n "enableJetifier" gradle.properties

2Fix

Turn Jetifier on only for this case. Android's own guide warns that it slows builds and should not be used unless necessary.

android.enableJetifier=true

3Verify

Sync and build again.

./gradlew :app:assembleDebug

Confirmed by developer.android.com

Did this fix it?

How do I stop it coming back?

  • Add libraries one at a time and build after each, so the one that breaks the merge is obvious.
  • Prefer maintained libraries that publish AndroidX artifacts.
  • Read the merger report whenever a manifest error mentions an attribute, not only the first line of the console.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Android Studio cannot pair the phone over Wi-Fi

The Pair devices over Wi-Fi dialog lists no device

Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.

4 causes, each with a fix

Mobile apps

adb tcpip 5555 fails because no device is found

adb: more than one device/emulator

adb tcpip only works while the device is attached and listed by adb, because it tells the phone to start listening on port 5555.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.