Bug 9614 - Share layouts between application
Summary: Share layouts between application
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.2.x
Hardware: PC Windows
: Highest normal
Target Milestone: ---
Assignee: PJ
Depends on:
Reported: 2013-01-16 13:02 UTC by Allie Miller
Modified: 2013-05-23 14:52 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 Allie Miller 2013-01-16 13:02:47 UTC
To create a Android Library Project to share between two applications, other than except for linking the files in both projects. Yet it is not possible yet to add for example layouts to this library project, because when added in the application project, the generated resources.designer.cs file is not valid (at least in MfA 4.4.41).

When following the suggested workaround (creating a new Android Application project, thus creating the Resources directory structure), then hand-edit the .csproj to remove the <AndroidApplication/> element to turn it into a Library project), the generated resources.designer.cs file was found not valid in 4.4.41. The result is the same error as the sample projects.

(To reproduce, create an application and a library project and then reference them and build).

What happens is that the resource designer wants to copy some IDs like this:

public static void UpdateIdValues()


AndroidShared.Resource.Drawable.Icon = InterWatt.IW4A.Resource.Drawable.Icon;

AndroidShared.Resource.Id.myButton = InterWatt.IW4A.Resource.Id.myButton;

AndroidShared.Resource.Layout.Main = InterWatt.IW4A.Resource.Layout.Main;

AndroidShared.Resource.String.app_name = InterWatt.IW4A.Resource.String.app_name;

AndroidShared.Resource.String.hello = InterWatt.IW4A.Resource.String.hello;


This fails, because the drawable icon.png is only in the library project, not in the application project.
Comment 2 Brad Moore 2013-04-11 03:03:26 UTC
I got the same issue. Not 100% if its a bug, or if I am not doing it correctly.
Comment 3 Brad Moore 2013-04-11 03:05:25 UTC
For instance I got this issue,

MSA_Android.Resource.Id.description = MSA_Android_TemplateApp.Resource.Id.description;

Where MSA_Android is my shared library, MSA_Android_TemplateApp is one of many apps that will try use MSA_Android. This errors as MSA_Android_TemplateApp does not have a Resource.Id.description.
Comment 4 Jonathan Pryor 2013-05-23 14:34:34 UTC
PJ: Please verify that this has been fixed in ~4.6.4+.
Comment 5 PJ 2013-05-23 14:52:55 UTC
With 4.6.6, I can successfully add a library project reference to a template app and build. I can also link to a n .axml file in a library project that is in the same solution and still build.

I'm not sure if the reproduction steps are sufficient, did we ever get the concise test case?