I create a new project in Xamarin.Forms and just debug it. I do nothing and just create a Apk file and apk size is 14.2 MB. I found some tutorial regarding and changes Linker behaviour to Link all assemblies. It reduces Apk size to 1 or 2 MB. In fact I am expecting size of such Apk should be in some kbs. What I am missing here?
You can read all about that here in the documentation.
Your main problem here is that a lot of .NET stuff is being included as it is not available on your Android device by default.
15.8 MB is a larger download size than we’d like. The problem is the BCL libraries, as they include mscorlib, System, and Mono.Android, which provide a lot of the necessary components to run your application. However, they also provide functionality that you may not be using in your application, so it may be preferable to exclude these components.
But they may not be necessary! This is where the Linker comes in.
When we build an application for distribution, we execute a process, known as Linking, that examines the application and removes any code that is not directly used. This process is similar to the functionality that Garbage Collection provides for heap-allocated memory.
You can access the linker settings from your Xamarin.Droid project properties. Look around at the different settings there and play with them to see what it has for effect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With