The type 'MediaSessionCompat' exists in both 'Xamarin.Android.Support.Media.Compat' and 'Xamarin.AndroidX.Media'

Buzzdown 46 Reputation points
2023-03-06T14:14:10.3666667+00:00

The type 'MediaSessionCompat' exists in both 'Xamarin.Android.Support.Media.Compat' and 'Xamarin.AndroidX.Media' and probably recognises twice the class MediaSessionCompat. I have tried to delete all Android.Support references and keep only the AndroidX, but it was not successful. After I tried to migrate my project to AndroidX but I have other issues, also which was not solved.

Developer technologies | .NET | Xamarin
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2023-03-06T15:20:52.5266667+00:00

    You still have references to the legacy Xamarin.Android.Support library and that is causing the problem. Note that you might be relying on a component that itself depends on it. Remove all NuGet package references to this package (and related). You can use the Dependencies node in Solution Explorer to see if there are any transitive dependencies.

    Also do a clean build although that shouldn't impact the build references.

    0 comments No comments

  2. Buzzdown 46 Reputation points
    2023-03-16T06:56:03.63+00:00

    I solved it, by changing manual some other package 's version which were compatible with the current packages.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.