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

  • Question

  • User9323 posted

    Hello.

    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?

    Monday, February 6, 2017 4:01 PM

All replies

  • User253824 posted

    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, Alexander.

    Monday, June 12, 2017 9:30 AM
  • User9323 posted

    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.

    Monday, June 12, 2017 11:46 AM
  • User253824 posted

    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!

    Monday, June 12, 2017 3:22 PM
  • User253824 posted

    @xakpc

    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: https://forums.xamarin.com/discussion/97461/android-manifest-file-merge-rules)

    Monday, June 12, 2017 4:43 PM