Bug 43964 - Deploy to Android Emulator is Failing - Reason: Item with the same key already added
Summary: Deploy to Android Emulator is Failing - Reason: Item with the same key alread...
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.1.2 (C7SR1)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-09-02 07:45 UTC by paul
Modified: 2016-09-04 07:32 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Output Log, Build, Diagnostic Verbosity (92 bytes, text/plain)
2016-09-02 07:54 UTC, paul

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description paul 2016-09-02 07:45:55 UTC
I'm new to Xamarin. I am building a Xamarin.Forms PCL cross-platform app using Visual Studio 2015 Community. I was making some good progress and was successfully deploying to an Android emulator running KitKat. After installing a bunch of Android SDK updates so I could test out on newer Android versions, and also attempting to consolidate and update the NuGets on the projects, I can no long deploy to any emulator. At the end of the build log I get...

Unexpected error - Please file a bug report at http://bugzilla.xamarin.com. Reason: An item with the same key has already been added.

I have two emulators that I can successfully start up and I get the same result when I try to deploy to either one of them for debugging. One is a KitKat (armeabi-v7a), the other is Marshmallow Intel Atom (x86_64).

I researched online and it seemed I may have some conflicting NuGet versions between the PCL and the Android projects. I used the NuGet Package Manager and went through each mobile app in the solution and I believe they are all running the same version.

At this point I'm at a complete stand still because I can no longer deploy and test the code.

I've attached the Output log for Build in Diagnostic mode.

Not sure if it's related, but I'm also getting a warning on the Error list (see below). The proposed fixes in the warning have already been added to the app.config file, but I still get this warning every time I build.

Warning		Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="mscorlib" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="" newVersion="" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="" newVersion="" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Xml" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="" newVersion="" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Configuration" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="" newVersion="" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Data.SqlXml" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="" newVersion="" /></dependentAssembly></assemblyBinding>	CrowsNest.Droid	C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets	2221
Comment 1 paul 2016-09-02 07:54:11 UTC
Created attachment 17311 [details]
Output Log, Build, Diagnostic Verbosity

file was too big to attach, and pasting the link was throwing an error as well, so I attached a file with the link in it
Comment 2 paul 2016-09-02 16:51:30 UTC
I found this page on Xamarin's web site (see link below), and it gives instructions to turn on Deployment logs for Android, but the checkbox it refers to on Tools->Options->Xamarin->Android Settings->Extension Debug Logging is not shown in the Visual Studio I'm running (2015 Community) so I can't turn this on.

Comment 3 paul 2016-09-04 07:32:40 UTC
I was able to figure out what the cause was. On the project settings, on the Android Options page, on the Packaging tab, the "Use Shared Runtime" option was unchecked. As soon as I checked this option, deployment starting working again.