Bug 23057 - Building APK fails with multiple project using the same obj directory
Summary: Building APK fails with multiple project using the same obj directory
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.18.0
Hardware: PC Windows
: Lowest enhancement
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2014-09-16 12:08 UTC by Adam Kapos
Modified: 2017-08-23 21:22 UTC (History)
3 users (show)

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

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 or GitHub 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 Adam Kapos 2014-09-16 12:08:21 UTC
If two projects have the same obj directory and one has an EmbeddedNativeLibrary, then it will be included in the other project too. Carefully building the projects one by one sometimes results in successful APK generation.

Even if the same obj folder is not a generally good idea, I would like to file this as a bug in the Xamarin.Android compiler, as we didn’t have any problem with this on any other platforms (including .Net and Xamarin.iOS).

Example output:
4> obj\Release\__library_projects__\MonoGame.Framework\native_library_imports\armeabi\libopenal32.so (TaskId:157)

4> obj\Release\__library_projects__\MonoGame.Framework\native_library_imports\armeabi-v7a\libopenal32.so (TaskId:157)

4> obj\Release\__library_projects__\MonoGame.Framework\native_library_imports\x86\libopenal32.so (TaskId:157)

4> obj\Release\__library_projects__\MonoGame.Framework.Net\native_library_imports\armeabi\libopenal32.so (TaskId:157)

4> obj\Release\__library_projects__\MonoGame.Framework.Net\native_library_imports\armeabi-v7a\libopenal32.so (TaskId:157)

4> obj\Release\__library_projects__\MonoGame.Framework.Net\native_library_imports\x86\libopenal32.so (TaskId:157)
4>The "BuildApk" task failed unexpectedly.
4>System.ArgumentException: An item with the same key has already been added.

Sample project:
Comment 1 Jonathan Pryor 2014-09-16 12:52:13 UTC
This is not currently supported.
Comment 2 Jon Douglas [MSFT] 2017-06-29 17:04:10 UTC
I am marking this issue as NEEDINFO for the time being as the reproduction project noted in https://bugzilla.xamarin.com/show_bug.cgi?id=23057#c0 no longer exists. We will need a new reproduction to confirm this behavior still exists in latest Xamarin builds. If this has already been fixed, please feel free to add a comment indicating this.
Comment 3 Cody Beyer (MSFT) 2017-08-23 21:22:37 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!