10

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

enter image description here

2
  • I had the same issue, debugging worked fine until that error came up. Restarting VS didn't help. Changing the Solution Platform did the trick. Commented Aug 16, 2016 at 11:15
  • For me, it had to do with an earlier warning, NU1605, about a detected package downgrade. That was unintentional, so after editing the csproj file to use the correct version, suddenly the Release build no longer complained about a failure to resolve System.Void Commented Sep 4, 2019 at 6:51

5 Answers 5

4

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.

enter image description here

  1. Right click MyApp.Droid
  2. Properties > Android Options > Advanced (tab)
  3. Set 'Java Max Heap Size' to 1024m
Sign up to request clarification or add additional context in comments.

4 Comments

@Adel Have u tried increasing the java heap size to a larger value?
Doesn't help :/
Right ans or even you can check it on developer.xamarin.com/guides/xamarin-forms/troubleshooting/… check this reference
Try to change 'Java Max Heap Size' to 1G P.S it's capital G
3

Try this configuration for Debug mode enter image description here

enter image description here

1 Comment

Yes, that fixes it by disabling the linker. Which is not the expected behavior. so it's not a solution.
2

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

Comments

2

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

Comments

0

Check Mono android subfolder in Xamarin.forms package folder, sometimes linking to old Mono android version. Change it to new. It worked for me. I changed from Monoandroid 8.0 to Monoandroid 9.0 of some dll's like Xamarin.Android.Platforms etc..

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.