Manifest merger fails on application@appComponentFactory after adding a library
Manifest merger failed : Attribute application@appComponentFactoryShort 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.
Fix it fast
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.txt2Match what you see, then jump to its fix
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:assembleDebugConfirmed by developer.android.com
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.properties2Fix
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=true3Verify
Sync and build again.
./gradlew :app:assembleDebugConfirmed by developer.android.com
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
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile 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 fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fixMobile 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