“Link Assemblies” task failed unexpectedly issue while App build in Release Mode Xamarin Android

こ雲淡風輕ζ 提交于 2019-11-29 18:56:58

问题


Getting the following issue while trying to build App Release Mode in Xamarin Android. Why is it appearing and how can it be resolved?

Severity Code Description Project File Line Source Suppression State Error

The "Link Assemblies" task failed unexpectedly.

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)

at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()

---End of inner exception stack trace ---

at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
at 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


回答1:


I was able to resolve the issue in by changing the Target Android Version and setting the Java Max Heap Size in the following manner.

  1. Right click MyApp.Droid
  2. Properties > Android Options > Advanced (tab)
  3. Set 'Java Max Heap Size' to 1024m



回答2:


Try this configuration for Debug mode




回答3:


I got this too after upgrading to Xamarin Forms. You need to make sure your Target Framework is the last version.




回答4:


After updated xamarin version i start getting this error. Clean project first then build it again. fixed for me. Rebuild not working.



来源:https://stackoverflow.com/questions/37177430/link-assemblies-task-failed-unexpectedly-issue-while-app-build-in-release-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!