Merge Mutiple Manifest File

Updated 18 December 2016


Our APK file can contain just one AndroidManifest.xml file, but our Android Studio project may contain several—provided by the main source set, build variants, and imported libraries. So when building our app, the Gradle build merges all manifest files into a single manifest file that’s packaged into our APK.

Merge Priority :-

Library Manifest file -> Main Manifest file -> Build Variant Manifest File.

(From Lowest Priority to High Priority Manifest files)

There is conflict occurs in a single app while merging, So, how to solve it?

There are many merge rule marker and their method i.e. checks Merger Tools when merging manifest files.

All markers belong to the Android tools namespace, so we must first declare this namespace in the <manifest>element as shown here:

I am talking only replace attribute of the marker.

Node Marker:-

tools:node="replace" Replace the lower-priority element completely. That is, if there is a matching element in the lower-priority manifest, ignore it and use this element exactly as it appears in this manifest.


Low priority manifest:


High priority manifest:


Merged manifest result:


Attribute Marker :-

If we want to apply the marker only attributes of manifest tag, then we use attribute marker.


tools:replace="attr, ...Replace the specified attributes in the lower-priority manifest with those from this manifest. In other words, always keep the higher-priority manifest’s values.

Low priority manifest:


High priority manifest:


Merged manifest result:


For more details go to link,

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home