New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Android APK is 1MB larger after upgrading Xamarin.Forms from SR4 to SR5 #14727
Comments
Probably due to #14101 then, I wouldn't know what else @jonathanpeppers is this something that sounds familiar to you? |
Can someone share the If you don't want to actually share the
It prints out the contents of what actually changed. I would also only compare Release builds you're shipping. |
So if So are the newer AndroidX classes just larger? Can you share the before/after |
I am sending the dex files for both Xamarin.Forms versions: I am also including the source for the project. But this is just the default project created by Visual Studio template with updated Nugets and a few settings for smaller size (linker, r8): I have just noticed that when I am upgrading the Nuget to SR5, Visual Studio shows a dialog with changes preview. It lists not not only updates to AndroidX packages but also a few new ones:
Maybe these are the reason for the size increase. However, 1 MB is quite a lot when a new service release with only bug fixes and no new functionality is installed. So I am wondering if the things added by SR5 are really code that is used or something unused that should be linked out. |
Yes, there appear to be many more java types: --class_defs_size : 2788
++class_defs_size : 3475 Here is a list of the types, and they just seem to match the newer AndroidX libraries: You said you are using |
I have checked that there is no custom proguard rules file. It is a starter project created by Visual Studio template with the following steps:
|
I think the newer AndroidX libraries are just larger. What is the size difference when you turn off r8? Are we sure it's actually shrinking things? |
I checked that R8 is doing something. When I turn it off, the APK is 756 kB larger (19,3 MB in total). |
Description
I have upgraded Xamarin.Forms 5.0 to SR5 in my project and I was surprised that the APK file became suddenly almost 1 MB larger.
I have tried also to create a new shell project using the default template in Visual Studio and I can confirm that also for this project the size grows rapidly just by upgrading the Xamarin.Forms Nuget to the latest SR5 version. I have set linker to link everything and enabled r8 to get the smallest APK size possible. I had to add Preserve attributes on a few places to make the project run work without crashing. Here is a comparison of the sizes:
Xamarin.Forms 5.0.0.2083: 17.8 MB
Xamarin.Forms 5.0.0.2125: 18.6 MB
The difference is almost 1 MB for the default project created by Visual Studio (and it is even more for more complex apps). The biggest increase seems to be in the classes.dex file.
What caused this? Is this extra size added by some external dependencies? Or is it a linker problem?
Steps to Reproduce
Expected Behavior
All service releases should produce APKs with similar sizes as they does not bring any new features.
Actual Behavior
Upgrading Xamarin.Forms to SR5 increases APK size significantly.
Basic Information
Environment
Show/Hide Visual Studio info
Workaround
Downgrade Xamarin.Forms to the nearest older version that works for you (this is SR3 in my case, because I had problems with SR4).
The text was updated successfully, but these errors were encountered: