The “LinkAssemblies” task failed unexpectedly when building for Android Release with Xamarin.Forms


The “LinkAssemblies” task failed unexpectedly when building for Android Release with Xamarin.Forms



When trying to build the release APK for my android app I'm getting the error:


"The "LinkAssemblies" task failed unexpectedly."



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).



I've checked the common case here https://docs.microsoft.com/en-us/xamarin/xamarin-forms/troubleshooting/questions/android-linkassemblies-error
but I'm still getting the error.


1>------ Build started: Project: NewProject, Configuration: Release Any CPU ----
1>C:UsersJonathanDocumentsAppsNewProjectNewProjectNewProjectNewProject.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>C:UsersJonathanDocumentsAppsNewProjectNewProjectNewProjectNewProject.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>C:UsersJonathanDocumentsAppsNewProjectNewProjectNewProjectNewProject.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>C:UsersJonathanDocumentsAppsNewProjectNewProjectNewProjectNewProject.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>NewProject -> C:UsersJonathanDocumentsAppsNewProjectNewProjectNewProjectbinReleasenetstandard2.0Sub-4.dll
1>Done building project "NewProject.csproj".
2>------ Build started: Project: NewProject.Android, Configuration: Release Any CPU ------
2> 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> NewProject.Android -> C:UsersJonathanDocumentsAppsNewProjectNewProjectNewProject.AndroidbinReleaseNewProject.Android.dll
2> 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> 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> 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> 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> 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>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.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:WindowsMicrosoft.NETFramework64v4.0.30319System.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>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.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:WindowsMicrosoft.NETFramework64v4.0.30319System.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>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly.
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.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. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Configuration.ConfigurationException
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Initialize()
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: --- End of inner exception stack trace ---
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object args)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute()
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2>C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1748,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



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.





There was a mismatch between the processor architecture of the project being built That is the main issue you're trying deploy your project to an Android architecture that isn't currently supported in your Release Any CPU configuration. I'd open the configuration manager and check your project configurations.
– Nick
Jun 29 at 13:08



There was a mismatch between the processor architecture of the project being built





I've tried changing the "Any CPU" to other options through the configuration manager, however I'm still getting the same error when building
– Jon Bould
Jun 29 at 15:11





You might have a package or reference to System.Configuration somewhere in your application. This assembly is not supported traditionally in the mobile subset: docs.microsoft.com/en-us/xamarin/cross-platform/internals/… I would recommend using something like grep to search through your whole project(dlls included) to find where this reference might be.
– Jon Douglas
Jun 29 at 15:40



System.Configuration


grep





I've looked through the references and can't find anything that might be referencing System.Configuration
– Jon Bould
Jun 29 at 16:42









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Export result set on Dbeaver to CSV

Opening a url is failing in Swift