4

I have an Xamarin Forms Android App in the version version 2.5.1.527436 and now I want to upgrade the Xamarin Forms version to 5.0.0.2012 to update the controls used in the app and improve it.

After updating the Xamarin forms version to 5.0.0.2012, I am facing the Java.lang. Out of memory exceptions in the starting page of the app after the splash screen. Below is the crash report.

java.lang.OutOfMemoryError: Failed to allocate a 7814092184 byte allocation with 1912926 free bytes and 510MB until OOM, max allowed footprint 3825854, growth limit 536870912
at crc643f46942d9dd1fff9.ButtonRenderer_ButtonClickListener.n_onClick(Native Method)
at crc643f46942d9dd1fff9.ButtonRenderer_ButtonClickListener.onClick(ButtonRenderer_ButtonClickListener.java:30)
at android.view.View.performClick(View.java:6304)
at android.view.View$PerformClick.run(View.java:24803)
at android.os.Handler.handleCallback(Handler.java:794)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6635)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)

I have tried the below solutions and it does not fix the problem.

How to fix Java.Lang.OutOfMemoryError in Xamarin.Forms android application?

Android:java.lang.OutOfMemoryError: Failed to allocate a 23970828 byte allocation with 2097152 free bytes and 2MB until OOM

Why does the exception occur?

halfer
  • 19,824
  • 17
  • 99
  • 186
Vijay457
  • 324
  • 2
  • 11

1 Answers1

2

Making an update that big sometimes is hard. You can try doing a small upgrade first, let's say to Xamarin.Forms 4, if the problem is solved, you might want to go to XF 4.8 or directly to 5.0.

You can go to any version that you like, but then your final goal will be 5.0

The solutions that you posted about the specific error, increase the heap. But maybe you should try to look for the cause of the error. It can be at your App class, or maybe your XAML, but trying to optimize it it's also a good practise

Juan Sturla
  • 1,254
  • 1
  • 4
  • 18