Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

The "LinkAssemblies" task failed unexpectedly

Hi everyone,

I'm still new to Xamarin development. I'm currently making an app with Xamarin.Android. It builds and runs fine when 'Linking' is set to None. When I set linking to 'Sdk Assemblies Only,' it throws the following error when building:

The "LinkAssemblies" task failed unexpectedly. Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'Android.Support.V7.App.ActionBarActivity' (defined in assembly 'ReactiveUI.AndroidSupport, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Support.V7.App.ActionBarActivity at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference) at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference) at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference) at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference) at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference) at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference) at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference) at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type) at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.MarkStep.Initialize() at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res) --- 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(DirectoryAssemblyResolver res) at Xamarin.Android.Tasks.LinkAssemblies.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() ArmgaSys.ConDoc.Droid

I tried adding 'Xamarin.Android.Support.v7.AppCompat;Android.Support.v7.AppCompat;' to the Skip linking assemblies but the error is still occurring.

Does anyone know what else might fix this error?

Answers

  • BillyLiuBillyLiu Member, Xamarin Team Xamurai

    @PapaGing99

    What's the Target Framework for your project? Are version match the dependencies of your NuGet package?
    Please check the following links:
    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/troubleshooting/questions/android-linkassemblies-error
    https://docs.microsoft.com/en-us/xamarin/android/deploy-test/linker#linkskip

  • PapaGing99PapaGing99 Member ✭✭

    @BillyLiu

    Thank you for your response.

    I have followed the steps from the first link you provided, but unfortunately it did not work.
    My Target Framework is set to Android 8.1, the Minimum Android version is set to API Level 19, and the Target Android version is set to 'Use Compile using SDK Version.'

    All of my NuGet packages do have matched versions, according to the Consolidate tab in NuGet Manager.

    I also tried adding the following line to AndroidLinkSkip, but it didn't seem to fix the issue either:
    <AndroidLinkSkip>Xamarin.Android.Support.v7.AppCompat;Android.Support.V7.App;ReactiveUI;ReactuveUI.AndroidSupport;ReactiveUI.Android.Support</AndroidLinkSkip>

  • BillyLiuBillyLiu Member, Xamarin Team Xamurai
    edited August 2018

    @PapaGing99
    According to the error message: (defined in assembly 'ReactiveUI.AndroidSupport, Version=7.4.0.0, Culture=neutral, PublicKeyToken=null'), have you try to use another version of ReactiveUI.AndroidSupport? Such as 8.7.2.

Sign In or Register to comment.