Troubleshooting Android Studio Error: Manifest Merger Failed for Apps Targeting Android 12

Published on 2024.02.18

If you are developing an Android app and have recently updated your target API level to Android 12, you might encounter the error message 'Manifest merger failed' when trying to build your project in Android Studio. This error occurs when there are conflicts between the manifest files of different dependencies or modules. In this article, we will explore the steps to troubleshoot and resolve this error.

Step 1: Analyze Manifest Merging Errors

The first step to fixing the manifest merger failure is to examine the error messages provided by Android Studio. Look for lines that start with 'Error:' or 'Warning:' in the build output or 'Messages' pane. These lines will give you an indication of what caused the merger failure.

Step 2: Check for Duplicate Declarations

A common cause of manifest merger failures is duplicate declarations of activities, services, or permission in your manifest file or the manifest files of your dependencies. Search for duplicate entries and remove them. Make sure to keep the required declarations and remove any redundant or conflicting ones.

Step 3: Resolve Manifest File Conflicts

If the error still persists after removing duplicate declarations, there may be conflicts between the manifest files of different dependencies or modules. In such cases, you need to manually resolve these conflicts by merging the conflicting parts of the manifest files. You can do this by using the <manifest> and <application> elements as the starting point and manually adding the required components and permissions from conflicting files.

Step 4: Use Tools to Identify and Resolve Conflicts

To simplify the process of identifying and resolving manifest conflicts, you can use tools like 'Android Manifest Merger' and 'Manifest Merger Viewer.' The Android Manifest Merger is a command-line tool that can provide detailed information about the conflicts and help you in resolving them. The Manifest Merger Viewer is a Gradle plugin that integrates with Android Studio and provides a visual representation of the merged manifest file.

Step 5: Update Dependencies and Gradle Plugin

Sometimes, manifest merger failures can be due to compatibility issues between the dependencies and the Gradle plugin. Make sure you are using the latest versions of the dependencies and the Gradle plugin by checking their respective documentation or the official Android developer website.

Step 6: Clean and Rebuild the Project

After applying the above steps, clean and rebuild your project in Android Studio. This will ensure that any cached or outdated manifest files are cleaned and the changes you made are applied to the build.


Manifest merger failures in Android Studio can be frustrating, but by following the above troubleshooting steps, you can identify the causes and resolve them effectively. Remember to analyze the error messages, check for duplicate declarations, manually resolve conflicts, use helpful tools, and keep your dependencies and Gradle plugin up to date. With these actions, you will be able to overcome the manifest merger failure and continue developing your Android app targeting Android 12 with ease.