Does Xamarin.Android support Manifest merging?

Emil Alipiev 271 Reputation points

I have a library project referencing on main project.
So in the xamarin.Android Library project's manifest I defined permissions like below

<manifest xmlns:android="" xmlns:amazon="" package="com.myapp">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="29" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

In the Main project I dont have those permissions.

What i expect at the end a merge between 2 Manifest files and those permissions defined in the Android library project should be included but when i check the obj\Debug\100 folder where androidmanifest. xaml is created, if i open it, i dont see those permissions.
Is manifest merge not included by default or should I do something?

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,284 questions
0 comments No comments
{count} votes

Accepted answer
  1. Joe Manke 1,091 Reputation points

    I don't know about that sort of manifest merging, but if you use the UsesPermission attribute in C# in the library, the permissions should be added to the manifest of the consuming project. Convention is to put them in AssemblyInfo.cs but as it's an assembly-level attribute you can put them in any .cs file.

    [assembly: UsesPermission(Android.Manifest.Permission.Internet)]
    [assembly: UsesPermission(Android.Manifest.Permission.Vibrate)]
    [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
    [assembly: UsesPermission(Android.Manifest.Permission.ReadExternalStorage)]
    [assembly: UsesPermission(Android.Manifest.Permission.AccessCoarseLocation)]
    [assembly: UsesPermission(Android.Manifest.Permission.AccessFineLocation)]
    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Emil Alipiev 271 Reputation points

    Actually found the related issue
    Something new was implemented but suggestion in the issue is not 100% working for me.
    I have updated the issue with the problem i have experienced

    0 comments No comments

  2. Mel Cvjetko 6 Reputation points Microsoft Employee

    Default Manifest merging was written in C# and is not ideal.

    Ideal world uses ManifestMerger.jar add following codesnippet to app csproj:

    0 comments No comments