You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
I decided to upgrade Xamarin.Forms Nuget in my application from 4.8.0.1560 to 5.0.0.1874. I was surprised when I created an APK archive that its size increased by a half megabyte just by this upgrade. This is a big change on Android. APK size affects startup time, and decreases the chance that a user will install the app (downloading applications from Google Store is not super fast) and increases the chance that the app will be the first on the list when the users need to free some space in their phones.
I am wondering where this extra 0,5 MB came from. Xamarin.Forms 5.0 focus on bug fixes. It does not add any new big features. On contrary, a few features were removed. I was expecting that this will make it slimmer and the resulting APK will be also smaller. So it was a surprise for me that the APK is actually bigger.
The increased size can be observed also on a new blank project created in Visual Studio. I have compared an APK for a blank project that uses XF 4.8 and an APK for the same project after upgrading it to XF 5.0. I have used the settings to get as small APK as possible (r8+d8, linking all code). I have uncompressed APK (it is basically a ZIP file) and this is what has changed:
assemblies folder: +132 kB
META-INF folder: +30 kB
res folder: +84 kB
classes.dex file: +327 kB
resources.arsc file: +115 kB
There are some other smaller changes that are not listed. Altogether the size of the APK content for a blank project increased by 692 kB just by upgrading the Xamarin.Forms Nuget. Because of the compression, the size of the APK itself increased only by 442 kB.
I have two theories what could cause the APK to be bigger with XF 5.0:
Linking is broken in XF 5.0 and some unused code is not removed (e.g. by the Preserve attribute used where it is not needed?).
The Nuget for XF 5.0 contains an additional code that cannot be used in Xamarin.Forms, but it still gets into the resulting package (maybe a code for the upcoming MAUI project). If this is the case, I would recommend exclude this stuff from a public version of the Nuget.
Note: I am publishing Android App Bundle instead of APK so it resulting size will be smaller. However, APK format is good for size comparison.
Steps to Reproduce
Create a blank Xamarin.Forms project in VS 2019. The only platform needed is Android.
Upgrade to Xamarin.Forms 4.8.0.1560. In the settings for the Release version, target Android 10. Furthermore, make sure that d8+r8 is enabled and set linking to "Sdk and User Assemblies". This itself produces APK that is 11 596 kB.
I have added x86 to the supported architectures just to be able to test the project on the emulator (to make sure that it runs). Adding this platform will make the APK bigger. Its size is now 14 281 kB.
Now, upgrade Xamarin.Forms Nuget to the latest stable 5.0 version (5.0.0.1874). Clean the solution, rebuild it, and create an archive. The size increased to 14 723 kB just by this change.
Expected Behavior
The APK size should be about the same, or lower (because of the features that were removed in Xamarin.Forms 5.0).
Actual Behavior
The APK size is bigger after upgrading to XF 5.0 even for a blank project.
Basic Information
Version with issue: 5.0.0.1874
Last known good version: 4.8.0.1560 (I did not test any other version)
Platform Target Frameworks:
Android: 10
NuGet Packages: Nugets from a blank Xamarin.Forms project created by VS 2019.
Environment
Show/Hide Visual Studio info
Microsoft Visual Studio Community 2019
Version 16.8.2
VisualStudio.16.Release/16.8.2+30717.126
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Community
Visual C++ 2019 00435-60000-00000-AA088
Microsoft Visual C++ 2019
ASP.NET and Web Tools 2019 16.8.553.28003
ASP.NET and Web Tools 2019
ASP.NET Core Razor Language Services 16.1.0.2052803+84e121f1403378489b842e1797df2f3f5a49ac3c
Provides languages services for ASP.NET Core Razor.
ASP.NET Web Frameworks and Tools 2019 16.8.553.28003
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 16.8.553.28003
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 16.8.553.28003
Azure Functions and Web Jobs Tools
C# Tools 3.8.0-5.20567.16+53c5d7d3cf13d88978744a32a27c5f8350a8400a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30924.1
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
Mono Debugging for Visual Studio 16.8.43 (00471f8)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 5.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
SQL Server Data Tools 16.0.62010.06180
Microsoft SQL Server Data Tools
TypeScript Tools 16.0.21016.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.8.0-5.20567.16+53c5d7d3cf13d88978744a32a27c5f8350a8400a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd
Microsoft Visual F# Tools
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Foo 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 16.8.000.255 (d16-8@d002176)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.8.0.507 (remotes/origin/d16-8@e87b24884)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.8.112 (86385a3)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 11.1.0.17 (d16-8/c0e2b8e)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: be2226b
Java.Interop: xamarin/java.interop/d16-8@79d9533
ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
SQLite: xamarin/sqlite/3.32.1@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc
Xamarin.iOS and Xamarin.Mac SDK 14.4.1.3 (e30c41de3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Reproduction Link
This is a blank Xamarin.Forms project created by Visual Studio with some settings changed (it corresponds to the step 3 in the "Steps to Reproduce" section). You can try to create an APK for this repro project, upgrade it to the latest XF 5.0, create another APK and compare their sizes: XamarinSizeTest.zip
The text was updated successfully, but these errors were encountered:
jsuarezruiz
added
5.0.0
Regression on 5.0.0
i/high
Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often
labels
Jan 13, 2021
Description
I decided to upgrade Xamarin.Forms Nuget in my application from 4.8.0.1560 to 5.0.0.1874. I was surprised when I created an APK archive that its size increased by a half megabyte just by this upgrade. This is a big change on Android. APK size affects startup time, and decreases the chance that a user will install the app (downloading applications from Google Store is not super fast) and increases the chance that the app will be the first on the list when the users need to free some space in their phones.
I am wondering where this extra 0,5 MB came from. Xamarin.Forms 5.0 focus on bug fixes. It does not add any new big features. On contrary, a few features were removed. I was expecting that this will make it slimmer and the resulting APK will be also smaller. So it was a surprise for me that the APK is actually bigger.
The increased size can be observed also on a new blank project created in Visual Studio. I have compared an APK for a blank project that uses XF 4.8 and an APK for the same project after upgrading it to XF 5.0. I have used the settings to get as small APK as possible (r8+d8, linking all code). I have uncompressed APK (it is basically a ZIP file) and this is what has changed:
There are some other smaller changes that are not listed. Altogether the size of the APK content for a blank project increased by 692 kB just by upgrading the Xamarin.Forms Nuget. Because of the compression, the size of the APK itself increased only by 442 kB.
I have two theories what could cause the APK to be bigger with XF 5.0:
Note: I am publishing Android App Bundle instead of APK so it resulting size will be smaller. However, APK format is good for size comparison.
Steps to Reproduce
Expected Behavior
The APK size should be about the same, or lower (because of the features that were removed in Xamarin.Forms 5.0).
Actual Behavior
The APK size is bigger after upgrading to XF 5.0 even for a blank project.
Basic Information
Environment
Show/Hide Visual Studio info
Reproduction Link
This is a blank Xamarin.Forms project created by Visual Studio with some settings changed (it corresponds to the step 3 in the "Steps to Reproduce" section). You can try to create an APK for this repro project, upgrade it to the latest XF 5.0, create another APK and compare their sizes:
XamarinSizeTest.zip
The text was updated successfully, but these errors were encountered: