Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentException: An item with the same key has already been added. Key: Android.Support.V4.Media.Session.MediaSessionCompat+IOnActiveChangeListenerImplementor #102

Closed
GameXX opened this issue May 19, 2020 · 4 comments
Assignees

Comments

@GameXX
Copy link

GameXX commented May 19, 2020

Xamarin.Android Version:

Xamarin.AndroidX last update

Describe your Issue:

Good evening, I proceeded to update the Android project by migrating to AndroidX.
The xaml preview does not display the Android preview and gives the error reported below.
I have already read something similar at this link and I believe the problems are connected #71.
The difference is that I don't use anywhere in the code the "MediaSessionCompat" class.

Steps to Reproduce :

Migrate to AndroidX

Include any relevant Exception Stack traces, build logs, adb logs:

System.ArgumentException: An item with the same key has already been added. Key: Android.Support.V4.Media.Session.MediaSessionCompat+IOnActiveChangeListenerImplementor at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x002b5] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:677 at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-10/external/bockbuild/builds/mono-x64/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:240 at Xamarin.AndroidDesigner.Java.JcwWrapperGenerator.GenerateAsync () [0x001b5] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Java/JcwWrapperGenerator.cs:32 at Xamarin.Designer.Tasks.WhenBoth[T1,T2] (System.Threading.Tasks.Task`1[TResult] task1, System.Threading.Tasks.Task`1[TResult] task2) [0x0003b] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer/Xamarin.Designer/TaskExtensions.cs:112 at Xamarin.AndroidDesigner.DesignerProject.SynchronizeAssemblies (System.Boolean firstSync) [0x001f1] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/DesignerProject.cs:1814 at Xamarin.Designer.Telemetry.TimingTaskExtensions.AsTimedOperationInternal (System.Threading.Tasks.Task originalTask, System.String eventName, Xamarin.Designer.Telemetry.ITelemetryCorrelation correlation, Xamarin.Designer.Telemetry.TelemetryProperties properties, Xamarin.Designer.Telemetry.ITimingReporter reporter, System.Boolean sendToTelemetry) [0x000d5] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer/Xamarin.Designer/Telemetry/DesignerTelemetry.cs:240 at Xamarin.AndroidDesigner.DesignerProject.InitializeIdeProjectAsync () [0x005e4] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/DesignerProject.cs:199 at Xamarin.AndroidDesigner.AndroidDesignerService.LoadProjectAsync (Xamarin.AndroidDesigner.IIdeProject ideProject, System.String resourcesDir, System.String projectResourcesDir) [0x00069] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/AndroidDesignerService.cs:540 at Xamarin.AndroidDesigner.MonoDevelop.AndroidProjectWrapper.FromProjectAsync (Xamarin.AndroidDesigner.AndroidDesignerService service, MonoDevelop.Projects.Project project) [0x00097] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner.MonoDevelop/AndroidProjectWrapper.cs:102 at Xamarin.Designer.Forms.XamarinStudioXamlPreviewerView.InitializeAndroidDesignerProject (MonoDevelop.Projects.DotNetProject androidProject) [0x00030] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Forms/Xamarin.FormsPreviewer.MonoDevelop/Xamarin.Designer.Forms/XamarinStudioXamlPreviewerView.cs:575 at Xamarin.Designer.Forms.Preview.AndroidXamlRenderer.EnsureAndroidIsReady () [0x00078] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Forms/Xamarin.Designer.Forms.Preview/Android/AndroidXamlRenderer.cs:90 at Xamarin.Designer.Forms.Preview.AndroidXamlRenderer.RenderOneXaml (MonoTouch.Design.XamlRenderContext context) [0x0004b] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Forms/Xamarin.Designer.Forms.Preview/Android/AndroidXamlRenderer.cs:129 at Xamarin.Designer.Forms.Preview.AndroidXamlRenderer.RenderXamls (MonoTouch.Design.XamlRenderContext context, System.Threading.CancellationToken token) [0x003c1] in /Users/runner/runners/2.165.0/work/1/s/Xamarin.Designer.Forms/Xamarin.Designer.Forms.Preview/Android/AndroidXamlRenderer.cs:293

@moljac
Copy link
Member

moljac commented May 20, 2020

@GameXX

First of all your MediaSessionCompat is in Android.Support.V4.Media.Session and this is not AndroidX namespace.

In order to help you, I'll need more info:

  • packages
  • build config (D8, R8, aapt2, multidex)

@moljac
Copy link
Member

moljac commented Jul 9, 2020

Related issue: #71

@moljac
Copy link
Member

moljac commented Jul 9, 2020

Possible workaround: #71 (comment)

@moljac
Copy link
Member

moljac commented Oct 7, 2020

Closing this one due to inactivity

@moljac moljac closed this as completed Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants