Bug 29903 - AndroidLinkSkip not working
Summary: AndroidLinkSkip not working
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 5.1
Hardware: PC Windows
: Normal normal
Target Milestone: 6.0 (C6)
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2015-05-09 13:06 UTC by pragma.mobilexp
Modified: 2015-08-05 10:55 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description pragma.mobilexp 2015-05-09 13:06:29 UTC
Seems like the AndroidLinkSkip feature is not working.  I'm trying to prevent an assembly from being linked to work around bug 29900 in the platform.  However, the assembly is still linked which results in me having to turn off linking for all assemblies to get a Release build out.  Our apk unfortunately goes from 18MB to 43MB which is unacceptable.  Other users seem to [have reported](http://forums.xamarin.com/discussion/16279/android-skip-linking-broken-in-4-12-03003) the issue as well.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2015-05-09 16:35:49 UTC
Thanks for the report.

If you have "Project Properties -> Android Options -> Linker [tab] -> Linking" set to "Sdk Assemblies Only", then the _application assembly_ isn't being _modified_ by the linker anyway.

The problem with Bug 29900 is that the linker is _reflecting_ on the application assembly to determine which types are safe to link out of the _other_ (SDK) assemblies. So unfortunately, if the linker is enabled _at all_ then you will hit Bug 29900, regardless of how many assemblies you skip using the `AndroidLinkSkip` property.

In short, I believe this bug can be marked RESOLVED ANSWERED (or similar).
Comment 2 Radek Doulik 2015-06-02 10:28:08 UTC
Yes, that's right. Even when the assembly is marked to be skipped, it needs to be loaded. Fortunately the bug #29900 is already fixed.
Comment 3 Adam Greene 2015-08-05 10:35:43 UTC
I'm still seeing this behaviour with Xamarin.Android 5.1.4.16 and Xamarin 3.11.666.0.
Comment 4 Adam Greene 2015-08-05 10:52:30 UTC
After further research, the problem I'm seeing is that XamarinVS and Xamarin Studio maintain different lists of skipped assemblies and the one that was in Visual Studio was the correct list but the one shown in Xamarin Studio was wrong (and the linker uses the XS version).  So I fixed the list in Xamarin Studio and now it links correctly.
Comment 5 Adam Greene 2015-08-05 10:55:59 UTC
To be honest, it might have been a bad merge...