Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
I've created an Android Class Library project, added one Activity and one "png" in Resources/Drawable and when I build the Resource.Designer.cs file isn't created.
In the build output I see:
So Monodroid is aware of the "png" file but for some reason doesn't create the Resource.Designer.cs file.
- Monodroid 4.4.54
- Visual Studio 2010 Ultimate Version 10.0.40219.1 SP1
Created attachment 3199 [details]
Example project that I've tried
Unfortunately the current Class Library templates don't make it possible to use Android Resource.
Currently, the easiest way to create an Android Class Library project which contains resources is to instead create an Android Application project, then hand-edit the .csproj to remove the following element:
You will now have a Class Library project which will build Android resource.
If you have an existing Android Library project, you can add support for Android resources by adding an <AndroidResgenFile/> element, and adding a <Compile/> for the $(AndroidResgenFile) value, e.g. the patch to Attachment #3199 [details]:
--- AndroidClassLibraryTest.csproj.bk 2013-01-11 13:11:37.000000000 -0500
+++ AndroidClassLibraryTest.csproj 2013-01-11 13:11:53.000000000 -0500
@@ -10,6 +10,7 @@
@@ -42,6 +43,7 @@
<Compile Include="Class1.cs" />
+ <Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
With these two changes, Android Class Library projects will build Android Resources.
I've tried the first solution and it worked.
I have another question: I have 2 apps which share 70% of the code and most of the views are basically the same except for some design differences. Is there a way of using the "base" app as a library project for the other one ?
As in: re-use the common code and just override differences in code and design.
This would really help me out because until now I've just duplicated the code and I'm planning on a major update and I would want to have to copy-paste everything from on app to another
I would recommend that you use links, i.e. add the files from one project to the other, but as links instead of copies.
I've tried replying to email@example.com but the mail couldn't be delivered. This is what I wrote in that email
I'm not sure what you mean by "view objects".
What I've tried so far is to use Jonathan Pryor's first suggestion https://bugzilla.xamarin.com/show_bug.cgi?id=9493#c3 (I've removed <AndroidApplication>True</AndroidApplication> from an Android Application Project) but I am having some problems: I've added the project AndroidLibraryTest2 as a reference to SampleApplication project, I've added a new Layout in the SampleApplication project, but when I try to open it I get this error:
"The operation could not be completed. Invalid pointer"
Perhaps I'm missing something on how reusing an application is suppose to work.
Created attachment 3218 [details]
Android library project test
The second attached project is what I've tried
@Mihai: Unfortunately I don't understand Comment #6.
> I'm not sure what you mean by "view objects".
I'm not sure which message you're referring to, so I don't know what is meant by "view objects" either. I imagine a "View object" is an instance of an Android.Views.View subclass.
> I am having some problems: I've added the project AndroidLibraryTest2
> as a reference to SampleApplication project, I've added a new Layout in
> the SampleApplication project, but when I try to open it I get this error:
> "The operation could not be completed. Invalid pointer"
This further confuses me:
1. Attachment 3218 [details] has two projects, AndroidLibraryTest2 and SampleApplication. However, SampleApplication doesn't have AndroidLibraryTest2 as a Project Reference, thus apparently contradicting the above. Furthermore, both projects aren't in the same solution (.sln), so they can't reference each other anyway.
2. What's the name of the New Layout?
3. What _exactly_ did you do to get the "Invalid pointer" message? Is that coming from MonoDevelop? From the build/ From running on the target device?
May I ask why this issue was marked as "INVALID"? It's still an open issue.
@Sebastian: Then let's call it a dupe of Bug #5870. :-)
*** This bug has been marked as a duplicate of bug 5870 ***