Bug 54320 - Android resources from lib forgotten by compiler if lib is not explicitely referenced in android app
Summary: Android resources from lib forgotten by compiler if lib is not explicitely re...
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 7.2 (15.1)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: dean.ellis
Depends on:
Reported: 2017-03-31 07:40 UTC by softlion
Modified: 2017-08-23 21:15 UTC (History)
7 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 softlion 2017-03-31 07:40:37 UTC
Just have a problem where the android resources from a C# android library project are not included in the final android app, as if they have been forgotten by the compiler.

It happened because this android lib "A" is only referenced by another android lib B, which is referenced by the final app. 
"A" is then automatically, by transitivity, compiled in the final app. But xamarin tooling won't detect that A was added by the compiler and won't compile its resources.

I fixed it by explicitely referencing lib "A" in the android app.

Side note: my lib A uses context.ObtainStyledAttributes(Resource.Style.MyControlDefaultStyle, Resource.Styleable.MyControl) internally to get its defaults. Witout referencing "A" in the final app, it was only getting en empty attribute set.


Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   3.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Xamarin (511c8b5)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (b16fb82)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS (06b241f)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Jon Douglas [MSFT] 2017-07-05 18:28:44 UTC
Do you perhaps have a reproduction project demonstrating this issue? This sounds like a potential limitation of the merging process of library resources.


We will first want to confirm the behavior to investigate a fix for this issue. Please attach a reproduction project starting with a File -> New Xamarin.Android Project
Comment 2 Cody Beyer (MSFT) 2017-08-23 21:15:13 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!