Bug 52857 - Support more advanced features of AndroidManifest.xml merging
Summary: Support more advanced features of AndroidManifest.xml merging
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 7.1 (C9)
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: dean.ellis
: 48153 (view as bug list)
Depends on:
Reported: 2017-02-27 18:30 UTC by Jon Douglas [MSFT]
Modified: 2018-03-30 02:57 UTC (History)
15 users (show)

See Also:
Tags: bb
Is this bug a regression?: ---
Last known good build:


Description Jon Douglas [MSFT] 2017-02-27 18:30:22 UTC

Our current AndroidManifest.xml merging process seems to be a bit limited. There are many use-cases where advanced manifest merging rules are needed to accomplish certain tasks within application development.

Gradle build currently supports quite an extensive AndroidManifest.xml merging process. You can see details outlined here:


These are mainly accomplished with merge rule markers defined by the xmlns:tools="http://schemas.android.com/tools".

Sample inside a <manifest>:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

Within these tools, there are different markers that apply a rule. Here are a couple of examples:

tools:node="merge" - Merges all attributes in this tag and all nested elements given there are no conflicts

tools:node="merge-only-attributes" - Merge all attributes in this tag only, do not merge nested elements

tools:node="remove" - Remove the element from the merged manifest

tools:node="removeAll" - Remove all elements matching the type

tools:node="replace" - Replace the lower priority element

tools:node="strict" - Creates a build failure when the element in lower priority doesn't match the high priority manifest rule

There is also a concept of Attribute Markers in which you can apply merge rules to specific attributes.


For example I could apply one of rules without the "node" definition to an attribute instead:

High Priority:

<activity android:name=”com.example.ActivityOne”

Low Priority:

<activity android:name=”com.example.ActivityOne”

Thus would remove the "android:windowSoftInputMode" attribute.


<activity android:name=”com.example.ActivityOne”

All of these features would be extremely useful for MSBuild and Xamarin.Android. It would allow application developers to customize their build process when dealing with third party SDKs and complex manifest merging that might add unwanted nodes/attributes to their application. This is common in native Android app development that involve advanced manifest merging tactics.

Whether this is supported in XML or via the Xamarin.Android flavored Attributes, it would cause less grief on our customers who try to integrate with third party libraries and need to customize the manifest merging process.

*Version Information


Comment 2 Ken Sykora 2017-02-27 20:01:12 UTC
Related Issue: https://bugzilla.xamarin.com/show_bug.cgi?id=48153
Comment 4 Jon Douglas [MSFT] 2017-10-04 16:43:45 UTC
*** Bug 48153 has been marked as a duplicate of this bug. ***
Comment 5 George Josh Karabin 2017-10-26 17:45:57 UTC
Adding a +1; I maintain a nuget at my company that's used for a number of internal projects. It would benefit from features to allow its users to override some of its permissions requests.
Comment 6 Reuben Tanner 2018-02-06 20:56:38 UTC
+1 - my team needs this as well
Comment 7 James 2018-02-26 08:01:04 UTC
added a feature request on github as per Jon for this
Comment 8 Trevor 2018-03-30 02:57:40 UTC
+1 - this is critical for us as we try to move from GCM to Firebase Messaging.

Note You need to log in before you can comment on or make changes to this bug.