Failed to complete the Link Building task when building the application in Xamarin Android release mode

Getting the following problem when trying to build Application Release Mode in Xamarin Android. Why does it appear and how can it be solved?

Severity Code Description Project File Row Source Suppression Status Error

The Link Assemblies task unexpectedly failed.

Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'System.Void Android.Widget.TextView :: SetTextAppearance (System.Int32)' (defined in 'Xamarin.Forms.Platform.Android, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = null ') from' Xamarin.Forms.Platform.Android, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = null 'could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Android.Widget.TextView :: SetTextAppearance (System.Int32)

in Mono.Linker.Steps.MarkStep.MarkMethod (link to MethodReference)
in Mono.Linker.Steps.MarkStep.MarkInstruction (Operating Instructions) in Mono.Linker.Steps.MarkStep.MarkMethodBody (body MethodBody)
in Mono.Linker.Steps.MarkStep.ProcessMethod (MethodDefinition method)
in Mono.Linker.Steps.MarkStep.ProcessQueue ()
in Mono.Linker.Steps.MarkStep.Process ()
in Mono.Linker.Steps.MarkStep.Process (LinkContext context)
in Mono.Linker.Pipeline.Process (LinkContext context)
in MonoDroid.Tuner.Linker.Process (parameters LinkerOptions, LinkContext & amp; context)
in Xamarin.Android.Tasks.LinkAssemblies.Execute ()

--- End internal exception stack trace ---

in Xamarin.Android.Diagnostic.Error (Int32 code, innerException exception, String message, Object [] args)
in Xamarin.Android.Tasks.LinkAssemblies.Execute ()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext () MyApp.Droid Build

enter image description here

+10
source share
4 answers

I was able to solve the problem by changing the Target Android Version and installing Java Max Heap Size as follows.

enter image description here

  • Right click on MyApp.Droid
  • Properties> Android Settings> Advanced (tab)
  • Set Java Max Heap Size to 1024 m
+4
source

Try this configuration for debug mode enter image description here

enter image description here

+3
source

I got this too after switching to Xamarin Forms. You must ensure that your target platform is the latest version.

+2
source

After upgrading the xamarin version, I will start getting this error. Clean up the project first and then create it again. fixed for me. Rebuild does not work.

+2
source

All Articles