locked
Error The "LinkAssemblies" task failed unexpectedly. RRS feed

  • Question

  • User267539 posted

    Hi there,

    I'm getting this error when i try to build the solution en release mode, using Visual Studio Pro Update 3 With Xamarin 4.2.0.703

    Severity Code Description Project File Line Suppression State Error The "LinkAssemblies" task failed unexpectedly. Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Reference to metadata item 'System.Void Android.Support.V4.Widget.DrawerLayout::AddDrawerListener(Android.Support.V4.Widget.DrawerLayout/IDrawerListener)' (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.Support.V4.Widget.DrawerLayout::AddDrawerListener(Android.Support.V4.Widget.DrawerLayout/IDrawerListener) 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 Java.Interop.Tools.Diagnostics.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() App1.Droid

    Do you have any idea why this happens ?

    Thursday, October 20, 2016 11:10 PM

All replies

  • User267549 posted

    I got the same error here...

    Friday, October 21, 2016 1:08 AM
  • User267539 posted

    Just one Error

    Friday, October 21, 2016 5:03 AM
  • User283325 posted

    I have this error too..

    Saturday, December 31, 2016 5:30 PM
  • User292885 posted

    Same here...

    Friday, January 20, 2017 6:13 PM
  • User42522 posted

    Whenever it unexpectedly fails, first thing I do is Clean Solution and Rebuild Solution. 90% of the time this error vanishes. Few times I might have done more than once.

    Friday, January 20, 2017 7:43 PM
  • User267539 posted

    No body knows, I really considerate to use Android Studio than Xamarin.Android

    Saturday, January 21, 2017 3:02 PM
  • User12817 posted

    Hi Everyone,

    This happens because you are on an old version of Xamarin.Forms. You need to update to the latest version if possible. You can view the cause of this error here:

    http://stackoverflow.com/questions/40081826/system-missingmethodexception-method-android-support-v4-widget-drawerlayout-ad/40112514#40112514

    Monday, January 23, 2017 8:43 PM
  • User263619 posted

    I'm getting error in my Forms app while building the android project.

    I use:

    Visual Studio Enterprise 2015 Update 3
    Xamarin.Forms V2.3.3.193
    Target Framework: "Use Latest Platform (Android 7.1)"
    Minimum Android version: API Level 21
    Target Android version: "Use Compile using SDK version"
    Android Options: Shared Runtime, Fast Deployment, Enable ProGuard,Debugger .Net (Xamarin), Linking SDK Only
    Xamarin for Visual Studio and Xamarin.Android latest version
    Android SDK Tools: 25.2.5
    Android SDK Platform-tools: 26
    Android SDK Build-tools: 26
    Android SDK-Platform: from Android 5.0.1 (API 21) to Android 8.0.0 (API 26)
    

    With this configuration everything works perfectly!!!

    But if I update Xamarin.Forms to:

    v2.3.4.224
    v2.3.4.231
    v2.3.4.247
    

    I'm getting this error:

    Severity Code Description Project File Line Suppression State Error The "LinkAssemblies" task failed unexpectedly. System.NullReferenceException: Object reference not set to an instance of an object. at Mono.Linker.Steps.ResolveFromAssemblyStep.ProcessLibrary(LinkContext context, AssemblyDefinition assembly) at Mono.Tuner.CustomizeActions.ProcessUserAssembly(AssemblyDefinition assembly) at Mono.Tuner.CustomizeActions.ProcessAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.BaseStep.Process(LinkContext context) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Run(Pipeline pipeline, LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) at Xamarin.Android.Tasks.LinkAssemblies.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() RSUI (MobileApps\RSUI) C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1569

    thanks alot

    Monday, June 19, 2017 2:36 PM
  • User330663 posted

    In the droid project, try changing the AndroidLinkMode to SdkAssemblies on the Properties | Android Options. https://developer.xamarin.com/guides/android/advanced_topics/linking/

    Tuesday, June 20, 2017 12:56 AM
  • User263619 posted

    Thanks @PeterZiminski,

    But none of the solutions worked: - Changing the AndroidLinkMode to SdkAssemblies on the Properties | Android Options - Clean and Rebuild - Changed target framework

    Tuesday, June 20, 2017 6:55 AM
  • User263619 posted

    Just remove the package "Mono.Data.Sqlite.Portable" version 1.0.3.5 NuGet from my project and it works.

    Thursday, June 22, 2017 10:28 AM
  • User363976 posted

    Thanks @PeterZiminski,@dlopment

    //But none of the solutions worked:

    //Changing the AndroidLinkMode to SdkAssemblies on the Properties | Android Options //Clean and Rebuild //Changed target framework

    It's work Changing to none on the Properties | Android Options

    Tuesday, January 9, 2018 9:30 AM