Shrinking the app package

No app uses all the features of all the included libraries. The .NET libraries are quite big, and we often only use a tiny subset. To reduce the size of an app, we need to remove any unnecessary code or libraries that exist in it.

How to do it...

To reduce the overall size of the app, we enable the linker. This is used to remove any unused code from our app, or from any assemblies that are used:

  1. We select either the Link SDK assemblies only option or the Link all assemblies option from the Linker behavior dropdown:
    How to do it...

    The linker options

  2. When we link assemblies, types and members are removed. To prevent members from being removed, ...

Get Xamarin Mobile Development for Android Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.