Unable to build Android APK "The "LinkAssemblies" task failed unexpectedly."

SuatKorkmazSuatKorkmaz USMember ✭✭✭

I know this is a known problem but no matter what I do I can't build the APK release.
Compile version is Android 6.0 (Marshmallow)
Minimum Android target is API Level 15
Target Android version is Android 6.0 (Marshmallow)
Xamarin Forms version is 2.3.1.114

The error is : The "LinkAssemblies" task failed unexpectedly.

And the full output is:
MSB4018: The "LinkAssemblies" task failed unexpectedly. 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'Mono.Security.Interface.MonoTlsProviderFactoryDelegate' (defined in 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065') from 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve Mono.Security.Interface.MonoTlsProviderFactoryDelegate 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process() 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process(LinkContext context) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute() 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: --- End of inner exception stack trace --- 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args) 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute() 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Is there something I can do? I'll appreciate all your help.

Best,
Suat

Tagged:

Best Answer

Answers

  • SuatKorkmazSuatKorkmaz USMember ✭✭✭
    edited August 2016

    I just noticed something weird. There are two iOS specific files in Android project debug folder.

    Xamarin.iOS.dll and Xamarin.iOS.xml files. This can't be normal, right?

  • DavidJiboyeDavidJiboye NGMember

    I had the same challenge. Removing the Xamarin.iOS reference solved it.

Sign In or Register to comment.