Manifest Merger Failed: Attribute application@appComponentFactory Issue
When building an Android project, you may encounter the error:
ERROR: Manifest merger failed : Attribute application@appComponentFactory is also present at [...]. Suggestion: add 'tools:replace="android:appComponentFactory"' to [element] to override.
This error occurs when multiple dependency libraries declare the same Android application attribute, appComponentFactory. Typically, this issue arises when your project includes both Android Support Libraries (e.g., com.android.support:appcompat-v7:28.0.0) and AndroidX Libraries (e.g., androidx.core:core:1.0.0).
To resolve this issue, you can either migrate your project to use AndroidX libraries exclusively or downgrade your Firebase dependencies.
Migrating to AndroidX
To migrate to AndroidX, follow these steps:
Downgrading Firebase Dependencies
Alternatively, you can downgrade your Firebase dependencies to versions that do not require AndroidX. However, this is not recommended as it may prevent you from accessing the latest features of Firebase.
To downgrade your Firebase dependencies, use the following versions in your build.gradle file:
implementation 'com.google.firebase:firebase-messaging:17.0.0'
After making these changes, clean and rebuild your project. This should resolve the manifest merger failure issue.
The above is the detailed content of How to Fix \"Manifest Merger Failed: Attribute application@appComponentFactory Issue\" in Android Projects?. For more information, please follow other related articles on the PHP Chinese website!