3

Since I updated my Xamarin Forms project to the latest Android Libraries 25.1.1 I can no, longer build a release because of this linker error

>>1>The "LinkAssemblies" task failed unexpectedly.
1>Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Void Android.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.App.Activity,Android.Net.Uri)' (defined in assembly 'Plugin.Share, Version=5.0.0.3, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.Android.Support.CustomTabs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Android.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.App.Activity,Android.Net.Uri)
1>   at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
1>   at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
1>   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
1>   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
1>   at Mono.Linker.Steps.MarkStep.ProcessQueue()
1>   at Mono.Linker.Steps.MarkStep.Process()
1>   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
1>   at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
1>   at Mono.Linker.Pipeline.Process(LinkContext context)
1>   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
1>   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
1>   --- End of inner exception stack trace ---
1>   at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
Federico Navarrete
  • 3,069
  • 5
  • 41
  • 76
Thomas
  • 8,397
  • 7
  • 29
  • 39

3 Answers3

4

You need to use version 6.X - prerelease as I noted in the Readme as it is built against 25.1.1

JamesMontemagno
  • 3,782
  • 1
  • 12
  • 13
2

I believe this occurs because you have a mismatch of library references:

In your application, you are referring Xamarin.Android.Support.CustomTabs 25.1.1

However the assembly the linker is complaining about is on an old version:

https://github.com/jguertl/SharePlugin/blob/master/Share/Share.Plugin.Android/packages.config#L4

Jon Douglas
  • 13,006
  • 4
  • 38
  • 51
2

as James Montemagno pointed out the new 6.X reelease is built against 25.x and this solves the linker problems

Thomas
  • 8,397
  • 7
  • 29
  • 39