Search code examples
androidxamarin-studio

Xamarin Android - Using an Activity from a Class Library - OutOfMemory Exceptions


So I'm a beginner to Android development and I've chosen to try the Xamarin extension for Visual Studio. With that, I have in mind to create multiple applications which I would like them all to use the same class library with shared Layouts / Activities / Fragments. my problem comes when I create the intent of an activity from the class Library, then on the StartActivity(myIntent) I get java.lang.OutOfMemoryError. Specifically on the SetContentView(Resource.Layout.MyLayout) within the activity I've aforementioned StartActivity. I have tried methods using Fragments but I encounter the same Memory issue. Also, if I copy the Activities / Fragments to my main application, I can use them without any problems so I'm thinking its something with how I'm referencing the dll.

I've included the library in the manifest and I've set my Java Max Heap Size to 1G. but these don't seem to resolve the issue. I've performed many Cleans and Rebuilds, still nothing.

Any help would be amazing and thanks in advance


Solution

  • https://stackoverflow.com/a/14769071/3670304

    Thanks to this I was able to discover it was an image I had on my Activity which was causing the issue.