Forum Xamarin Xamarin.Android

Xamarin.Android does not support manifest merging - how can I remove permission from final manifest?

xakpcxakpc RUUniversity ✭✭
edited February 2017 in Xamarin.Android


As far as I can see Xamarin.Android does not support manifest merging more than simple merge. I searched through the forum and bug tracker but all I found was this old ticket, and several unanswered questions.

I trying to remove HockeySDK.Xamarin permission as stated in manual

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />

Removing this permission is essential for the application because it can disturb users and prevent installs.

I wonder, are there any BuildActions or MSBuild tasks that can help me remove permission from final AndroidManifest.xml before it packed in APK?


  • AlexanderMelchersAlexanderMelchers NLMember ✭✭

    Hi Pavel,

    Have you figured out a way to perform manifest merging? We're running into the same problems here and can no longer get our App into Google Play without this functionality.

    Best regards,

  • xakpcxakpc RUUniversity ✭✭

    Hi Alexander,

    We removed HockeySDK from our app completely.

    As far as I understand to solve this problem you need to create a custom MSBuild task which will remove an unwanted node from final AndroidManifest.xml.

    You can use MSBuild Targets to inject this task right before _CreateBaseApk task. I am not sure though that this task creates final AndroidManifest and Detailed build log has no information about this either. But I think it worth to try.

  • AlexanderMelchersAlexanderMelchers NLMember ✭✭

    Hello Pavel,

    Thanks for the tip! I have indeed been looking into hooking up to custom MSBuild targets, but have as of yet mainly been focussing on the PostBuildEvent. Problem there was that, even though I managed to apply the necessary changes to the AndroidManifest, they would immediately be overwritten by the packaging-target. Hence, it might indeed be worth looking into the _CreateBaseApk target to see if that solves my problem... I'll let you know!

  • AlexanderMelchersAlexanderMelchers NLMember ✭✭
    edited June 2017


    It worked!! It's certainly not the most elegant of solutions - adding a platform-specific executable task to a custom build target to run a bash script that uses XSL-T to clean up the unwanted permission - but it did the trick! Thanks for the suggestion! Would have taken me ages without it! ;)

    (more information on both problem description and solution to be found here:

Sign In or Register to comment.