I have very tired with getting java lang out of memory exception in xamarin android project. I didn't find what the root cause of getting this exception. In my android properties set up heap size is '1G' but still getting same issue.I am not getting any issue while xamarin ios project set as starting project.So many post's are suggest to these following solutions 1. increase heap size 2.set large hepad size is true in android manifest file, I am fallow those solutions but getting same issue. Here is the error what I am getting. Please suggest any idea of how to fix this issue.
3 Answers
Just like you did with the PATH stuff in the other thread, add that to the export _JAVA_OPTIONS="-Xmx1g"
to the mix, restart Visual Studio and see if that helps.
If you are still running into issues with with the build failing with an OutOfMemoryException you can try upgrading your JDK to use x64 instead of x86. The x64 JDK handles the larger Heap Size better than the x86 JDK.
Another problem is that maybe you have installed two versions of JDK tries to uninstall one and stay with the most current or that supports 64 bits.
I ran into this issue building my android project and @G.hakim's suggestion worked perfectly for me. Thanks for that @G.hakim! For those Building in Visual Studio on Mac,
- Open The MainApplication.cs file in your Droid Folder
Add the following line before the
public class MainApplication:...
declaration[Application(HardwareAccelerated = true, LargeHeap = true)]
Thats it! You can also implement the FFImageLoading package, if your app is image heavy.