Mono.Linker.MarkException: Error processing method: 'System.Void AndroidX.RecyclerView.Widget.RecyclerView/LayoutManager

Viewed 9632

I am trying to debug my Xamarin project. Framework and all packages are up to date. In iOS it works, but in Android NOT. How can I solve this problem:

Mono.Linker.MarkException: Error processing method: 'System.Void AndroidX.RecyclerView.Widget.RecyclerView/LayoutManager::n_OnInitializeAccessibilityNodeInfo_Landroidx_recyclerview_widget_RecyclerView_Recycler_Landroidx_recyclerview_widget_RecyclerView_State_Landroidx_core_view_accessibility_AccessibilityNodeInfoCompat_(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr)' in assembly: 'Xamarin.AndroidX.RecyclerView.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve AndroidX.Core.View.Accessibiity.AccessibilityNodeInfoCompat
   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.MarkMethodBody(MethodBody body)
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   --- End of inner exception stack trace ---
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
   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)
   at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
   at Xamarin.Android.Tasks.AndroidTask.Execute()       
9 Answers

I encountered this same problem after updating Visual Studio to 16.9.2 and updating the Android SDK.

The simple solution was to update the 'Xamarin.AndroidX.RecyclerView' Nuget package in the package manager. I Updated to the latest version (v1.1.0.8).

Same problem but i did not have 'Xamarin.AndroidX.RecyclerView' installed.

Solution: install in android project 'Xamarin.AndroidX.RecyclerView' and all work fine

Zee's answer is correct. here is the explanation which can solve other similar issues. https://github.com/xamarin/AndroidX/issues/283

jpobst commented on 1 Mar When resolving transitive dependencies, NuGet unfortunately picks the lowest dependency that meets the criteria. This means that fixes made to transitive dependencies often don't get picked up.

In this case the issue is the namespace misspelling (AndroidX.Core.View.Accessibiity) was corrected, however one (or more) of the packages that uses types from that namespace are not being updated.

You will need to make sure you are using the latest versions of these packages, which may require adding an explicit package reference to them:

Xamarin.AndroidX.Core
Xamarin.AndroidX.CustomView
Xamarin.AndroidX.Preference
Xamarin.AndroidX.RecyclerView

I had this error. In my case, it was finally solved by removing the Xamarin.AndroidX.Legacy.Support.V4 NuGet, which was not needed anyway. I think the auto AndroidX migration put it in.

To me, the problem was with VS 16.9.3 and the release build, and the solution was to remove the dependency on Xamarin.AndroidX.AppCompat.AppCompatResources.

Same issue occurred for me today after I updated all my nuget packages, the issue was resolved when I cleaned and rebuilt the solution.

For me the problem started when I upgraded to Xamarin.Firebase.Messaging v 121.1.0 - reverting to v121.0.1 resolved the problem - at least temporarily

My solution is installing: Xamarin.Google.Android.Material via Nuget

Update Visual Studio to the latest version and remove the Xamarin.AndroidX.RecyclerView nugget if you have it installed.

Related