Bug 38808 - Upload to Device does not use the Linking option
Summary: Upload to Device does not use the Linking option
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Radek Doulik
Depends on:
Reported: 2016-02-16 16:42 UTC by Neal
Modified: 2017-08-23 20:53 UTC (History)
4 users (show)

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:

Description Neal 2016-02-16 16:42:18 UTC

I push builds to my connected Android device using the Upload to Device option.  In my RELEASE config I have Link SDK Only.  However, on the device I get a massive app so it is clear that linking is not occurring.  I'm not sure if this is "by design" but I believe on the iOS side linking is honored.  Please check if the upload option in Android should be honoring the project config as well.

=== Xamarin Studio ===

Version 5.10.3 (build 14)
Installation UUID: 93bdb3c9-7b71-482a-86ba-69afd1ffd0e7
	Mono 4.2.2 (explicit/996df3c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402020030

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.2.1 (9548.1)
Build 7C1002

=== Xamarin.Mac ===

Version: (Business Edition)

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 962a050
Branch: master
Build date: 2016-01-29 16:59:11-0500

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/Neal/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.2

Java SDK: /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Build Information ===

Release ID: 510030014
Git revision: 0d40d692177e240b28e9c18e4f56b8fffa28268c
Build date: 2016-02-03 11:36:50-05
Xamarin addins: 2d840b1de5d7161a18abed40e5a06fd79a7684d3
Build lane: monodevelop-lion-device-hang-fix

=== Operating System ===

Mac OS X 10.11.3
Darwin NEALs-iMacR.local 15.3.0 Darwin Kernel Version 15.3.0
    Thu Dec 10 18:40:58 PST 2015
    root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64
Comment 1 Jonathan Pryor 2016-02-17 20:25:36 UTC
> However, on the device I get a massive app so it is clear that linking is not occurring.

There are any number of reasons for a massive app, such as the app itself pulling in lots of dependencies, or linking being disabled in the .csproj.

Could you please attach a repro which demonstrates your linker size concerns?

For a quick way to see if any linking is being done, compare the file sizes between obj/Release/android/assets (unlinked) and obj/Release/assemblies (linked):

# Default template:
>  ls -l obj/Release//assemblies/Mono.Android.dll obj/Release//android/assets/Mono.Android.dll
> -rw-r--r--  1 jon  staff    741888 Feb 17 15:22 obj/Release//android/assets/Mono.Android.dll
> -rwxr-xr-x  1 jon  staff  24176640 Jan 21 01:09 obj/Release//assemblies/Mono.Android.dll
Comment 2 Neal 2016-02-17 20:29:12 UTC
In RELEASE mode Link SDK Only is enabled as outlined in my original post.  If I archive and build an APK and install that it's normal/expected size - if I upload to device from Xam Studio it's very large.  I reviewed the apps area of my Nexus 7 to compare the two once installed.
Comment 3 Prashant [MSFT] 2017-06-27 08:06:14 UTC

Could you share the requested information in the comment#1? It will help us to troubleshoot the issue.
Comment 4 Cody Beyer (MSFT) 2017-08-23 20:53:55 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!