Error The "LinkAssemblies" task failed unexpectedly.

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 ?

Posts

  • ericchan555ericchan555 HKMember

    I got the same error here...

  • lfialloslfiallos HNMember

    Just one Error

  • van8tkavan8tka RUMember ✭✭

    I have this error too..

  • GerryHGerryH USMember ✭✭✭

    Same here...

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    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.

  • lfialloslfiallos HNMember

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

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    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

  • dlopmentdlopment USMember ✭✭

    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

  • PeterZiminskiPeterZiminski USMember ✭✭

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

  • dlopmentdlopment USMember ✭✭

    Thanks @PeterZiminski,

    But none of the solutions worked:

    • Changing the AndroidLinkMode to SdkAssemblies on the Properties | Android Options
    • Clean and Rebuild
    • Changed target framework
  • dlopmentdlopment USMember ✭✭

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

  • schwantzschwantz Member

    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

Sign In or Register to comment.