Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 53250 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 20276 [details]
When building an app that references a .dll with an embedded .so, the linker does not remove the native bits from the managed assembly. It correctly copies the native library into the lib directory in the .apk, but then includes the fat managed .dll instead of stripping the native bits out first.
In the attached project, the SkiaSharp.dll is about 10MB inside the .apk. It should only be a few KB. The native libSkiaSharp.so is in the lib directory correctly.
The issue is with my machine: https://gist.github.com/mattleibow/339f1955f3545470133b14dccfc58fbe
(And VS on the same versions)
It's seems, resources are duplicated in apk. Now dll's in apk contains all resources(png, xml), so, e.g. lib's size in apk increased from 300KB to 3.5MB.
Other similar reports: https://forums.xamarin.com/discussion/90193/updating-to-xamarin-android-7-1-0-41-increase-apk-size
Ok world, I think we managed to find out some areas of where things are going wrong, and are working to fix that ASAP.
As a workaround, there is a simple change to the linker settings. If the "Link all assemblies" option is selected, the files are properly shrunk.
As this may not be possible for some assemblies, especially if there is reflection/deserialization, specific assemblies can be ignored using the "Ignore assemblies" text box.
For example, in this sample if I wish to skip over the "SkiaSharp.Views.Android.dll" assembly, but still link everything else out, I change the linker option to link all, and then enter "SkiaSharp.Views.Android" in the ignore text box. (note: no ".dll" extension)
I always use linking sdk and user assemblies. Resources are not shrunk at the latest xamarin version from dll
To clarify, do you use "Link all assemblies" in the Linker options?
Yes. Link all assemblies. Just one note(I forgot to mentioned it), I use Preserve attribute in projects, so custom libraries don't link. But I can't avoid this, because linking cut all default constructors in ViewModels, so Mvvmcross can't create viewmodel
I have meanwhile worked on the issue in the sample project. I have a fix for cecil waiting for review. https://github.com/jbevain/cecil/pull/368
It should fix the bug.
Is there a fix imminent for this? It has blown our app from 30MB to 50MB so it is pretty critical
We are seeing this issue as well. Our app size has increased by about 10 MB, and the Link all assemblies option is too high risk at this point in our release schedule. Any updates on when a fix will be available?
Yea, this issue is critical to me. I created a blank app and it was 8 MB. Hopefully this gets addressed soon.