I created an Hello World app using Xamarin and Android Studio. When I enter the App Manager, the application built with Xamarin has a size of 47 Mb whereas the size of the application with Android Studio has a size of 12 Mb. I know that the cross-platform must be larger, but why is it this big? Isn't there any export setting that can make it smaller?
It is large because it most contain a package that includes the application, the libraries, the Mono runtime and so on such as the BCL libraries (Base class libraries). Below, you can find how the size of the packages for a a basic release package
For debug, it's a bit different. At first, when debugging on an Android device, it's required to copy 2 larges packages (Shared Runtime & Platform). The first contains the BCL and the mono runtime and the other one contains the specific droid API level that your app would be targeting.
In order to reduce the app size while debugging, you can use fast assembly deployment option. This option enables you to install directly the packages you require on your testing device. Doing so, the app package size is greatly reduced. To do so, find the Options inside of Xamarin Studio. Then, you're going to find the Build section and click on Android Build. Finally, click on both Use shared Mono runtime and the Fast assembly deployment checkboxes. Save your changes and build your app with your device connected and you should be good to go :)
UPDATE 1
After talking about it for a while in the comments, I found that it would be best to have all the relevant information in here instead of forcing the reader to go downs in the commentary section and find out more about what he/she came here to find. So I was ask about about the way one would be able to reduce the app size in Release mode. In the release mode, you're going to have to use the post of the @kent.green concerning Linking. A quick overview of the post: Linking enables you to moves from an app with a size of 14.0 Mb to 4.4 Mb by using static analysis and removing assemblies that aren't use by the app in any way possible. For people looking for something similar for iOS, take a look at this post.
Also, the OP was concerned about the debug mode of his/her app. The OP wanted to know if by enabling fast assemblies deployment if one would lose functionalities such as resources monitoring or crash reports. I responded by saying that, from on a technical point of view, the fact remains that the same functionality is there. Instead of having an app package of size X, the size of the package is being reduced by using the your testing device and put "unnecessary" stuff there to make the package smaller. I do not think that both Shared libraries are being affected by this.
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