When should you only link "Sdk Assemblies"?

I am developing an application for Android using Xamarin and Visual Studio 2013. If you go to Project Properties / Android Settings / Connectivity , then there are three options: None

, Sdk Assemblies Only

and Sdk and User Assemblies

.

My questions are: when will you choose the option Sdk Assemblies Only

? Don't always want to include user assemblies in your release build?

Update The word is Linking

actually used to refer to Unlinking

in Xamarin Docs . This all makes sense when the text is preprocessed with this condition.

+3


source to share


2 answers


You would use an option Sdk Assemblies Only

if you want unused Xamarin.Android assemblies that you linked to your project to be removed when you create the APK. A complete list of these assemblies can be found here.

Let's say you added the System.Net assembly to your project, but didn't actually use it in your code and forgot to remove it. Specifying a linker option Sdk Assemblies Only

will cause the build chain to block build from your final APK, which will reduce the overall size of the app.

You can test this behavior by viewing the final APK as a zip file and checking the build directory:



enter image description here

In the above image, you will see what System.Net.dll

and System.Xml.dll

are in the Don't Link

generated APK, whereas they were removed from the APK that was generated with Sdk Assemblies Only

. These are project references, but are never used in source code, Xamarin detects this through static analysis and then excludes them from the APK.

+4


source


Xamarin.Android

apps use a linker to reduce the size of the app. Default valueSdkOnly

  • None

    : No links will be taken.
  • SdkOnly

    : Linking will only be done in base class libraries, not user assemblies.
  • Full

    : Linking will be done in base class and assembly user libraries. Read more here .. Note. If you run into a problem with the link, for example

"GetAdditionalResourcesFromAssemblies" ended unexpectedly. System.IO.FileNotFoundException :. Perhaps this doesn't exist in the Mono profile for Android?



then recheck your xamarin.Android project settings and set the tag below,

<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>

      

Hope this will be helpful.

0


source







All Articles