This repository was archived by the owner on Jun 20, 2023. It is now read-only.
Setup [assembly: LinkerSafe] for binding projects #77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Support Libraries Version (eg: 23.3.0):
26.1.0.1
Does this change any of the generated binding API's?
Nope
Describe your contribution
I discovered there was some file size that could be spared from the
support library assemblies in release APKs by using the
Link all assemblies
option. Since most Xamarin users will have theLink SDK only
option set, we can save most Xamarin developers some APK size bysetting up the
[assembly: LinkerSafe]
attribute in the supportlibraries.
To get an idea on what this saves, I tested the default Xamarin.Forms
template in VS for Mac. I then upgraded to
TargetFrameworkVersion
8.0, API 26, Xamarin.Forms 2.5.0, and 26.1.0.1 support libraries.
Before:
After
[assembly: LinkerSafe]
:It appears this change saves ~3.6MB in APK file size in release mode
for the default Xamarin.Forms template. The app still seemed to work fine,
it appears we can just get this file size for free!
Further details
Here is the results of
zipinfo
on the before APK:Here is the results of the after APK with
[assembly: LinkerSafe]
:Here is my
packages.config
: