On Aug 24, 2011, at 2:58 PM, Steve Sharrock wrote:
> We have some common Mono for Android Class Library projects in a VS2010
> solution that are referenced by the main application (same solution). These
> all work well until we try to include Activities and their Layouts in a
> library and then call them with StartActivityForResult( intent, id ).
> Putting the library Activities into a Mono for Android Application project
> (instead of Class Library) gets closer; but, still falling of the end of
> debugging...

The problem is that Mono for Android Class Libraries are a curiously half-baked 
concept when it comes to assets and resources.

The short version is that assets & resources aren't supported within class 
library projects.

The longer (untested!) version is that Android/Java supports class library 
projects by "simply" appending `-S dir` to the `aapt package` step, which 
generates R.java. Thus, IN THEORY, if you were to change your 
$(AndroidResgenExtraArgs) and $(MandroidExtraArgs) MSBuild properties, you 
could instruct them to include the assets and resources from your library 
projects into your main app:

        <PropertyGroup>
                <AndroidResgenExtraArgs>-A ..\Project1\Assets -S 
..\Project1\Resources</AndroidResgenExtraArgs>
                <MandroidExtraArgs>-A ..\Project1\Assets -S 
..\Project1\Resources</MandroidExtraArgs>
        </PropertyGroup>

Now, this very probably won't work (`aapt` requires lowercased resource names, 
we usually run a prebuild step to "fix" XML files to lowercase resource 
references, etc.), but it could work with some finagling.

The better solution is for us to properly implement this support; I'm not quite 
sure when we'll get to it on our priority list. :-(

The "best" short-term solution is to change your code so that your Library 
types have the resource ids passed as parameters instead of hard-coding them.

 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to