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>:
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:
Thus would remove the "android:windowSoftInputMode" attribute.
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.
Related Issue: https://bugzilla.xamarin.com/show_bug.cgi?id=48153
Related Issue: https://bugzilla.xamarin.com/show_bug.cgi?id=51689
*** Bug 48153 has been marked as a duplicate of this bug. ***
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.