title: The "LinkAssemblies" task failed unexpectedly when building for Android Release with Xamarin.Forms
body: <p>When trying to build the release APK for my android app I'm getting the error: </p>
  
  <pre><code>"The "LinkAssemblies" task failed unexpectedly."
  </code></pre>
  
  <p>I've tried everything I can find on other forum posts and online and nothing is working. (Posts I've seen include - A reference to xamarin.ios , minimum target android version needing to be 21 or higher. Both have been checked and aren't causing the issue).</p>
  
  <p>I've checked the common case here <a href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/troubleshooting/questions/android-linkassemblies-error" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/xamarin/xamarin-forms/troubleshooting/questions/android-linkassemblies-error</a>
   but I'm still getting the error.</p>
  
  <pre><code>1&gt;------ Build started: Project: NewProject, Configuration: Release Any CPU ----
  1&gt;C:\Users\Jonathan\Documents\Apps\NewProject\NewProject\NewProject\NewProject.csproj : warning NU1701: Package 'Plugin.CrossPlatformTintedImage 1.0.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
      1&gt;C:\Users\Jonathan\Documents\Apps\NewProject\NewProject\NewProject\NewProject.csproj : warning NU1701: Package 'Xam.Plugins.XamJam.Screen 1.0.7' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
      1&gt;C:\Users\Jonathan\Documents\Apps\NewProject\NewProject\NewProject\NewProject.csproj : warning NU1701: Package 'Xamarin.Forms.CarouselView 2.3.0-pre2' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
      1&gt;C:\Users\Jonathan\Documents\Apps\NewProject\NewProject\NewProject\NewProject.csproj : warning NU1701: Package 'Xamarin.UITest 2.2.4' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
      1&gt;NewProject -&gt; C:\Users\Jonathan\Documents\Apps\NewProject\NewProject\NewProject\bin\Release\netstandard2.0\Sub-4.dll
      1&gt;Done building project "NewProject.csproj".
      2&gt;------ Build started: Project: NewProject.Android, Configuration: Release Any CPU ------
      2&gt;  No way to resolve conflict between "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
      2&gt;  NewProject.Android -&gt; C:\Users\Jonathan\Documents\Apps\NewProject\NewProject\NewProject.Android\bin\Release\NewProject.Android.dll
      2&gt;  No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
      2&gt;  No way to resolve conflict between "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
      2&gt;  No way to resolve conflict between "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
      2&gt;  No way to resolve conflict between "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
      2&gt;  No way to resolve conflict between "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2245,3): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Data.OracleClient.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2245,3): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Web.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly.
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018: Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Configuration.ConfigurationException' (defined in assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') with scope 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---&gt; Mono.Cecil.ResolutionException: Failed to resolve System.Configuration.ConfigurationException
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Mono.Linker.Steps.MarkStep.Initialize()
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Mono.Linker.Pipeline.Process(LinkContext context)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext&amp; context)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    --- End of inner exception stack trace ---
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Xamarin.Android.Tasks.LinkAssemblies.Execute()
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
      2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1748,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.&lt;ExecuteInstantiatedTask&gt;d__26.MoveNext()
      ========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>I can see it's something to do with a reference to "System.Configuration.ConfigurationException" but I can't find any reference to this in my project.</p>