2
votes

I have a problem with Xamarin.Forms. When I rotate the orientation, or sometimes when I just try to open a new page I get an unexpected error.

See image here

0x21 in System.Diagnostics.Debugger.Mono_UnhandledException_internal

0x1 in System.Diagnostics.Debugger.Mono_UnhandledException

0x26 in object.7581e694-d3dd-45ce-9fdf-93ab5f3b26ee

0x11 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw

0x6A in Android.Runtime.JNIEnv.CallStaticObjectMethode at /User/builder/data/lance/monodroid-milon-monodroid-4.18-series/3b7ef0a7/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1161,5

0x73 in Android.Graphics.Bitmap.CreateBitmap at /User/builder/data/lanes/monodroid-milon-monodroid- 4.18-series/3b7ef0a7/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.Graphics.Bitmap.cs:621,21

0x7 in Xamarin.Forms.Platform.Android.ButtonDrawable.CreateBitmap

0x41 in Xamarin.Forms.Platform.Android.ButtonDrawable.Draw

0x13 in Android.Graphics/Drawables/Drawable.n_Draw_Landroid_graphics_Canvas_at /User/builder/data/lanes/monodroid-milon-monodroid-4.18-series/3b7ef0a7/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.Graphics.Drawables/Drawable.cs:988,4

0x17 in object.7581e694-d3dd-45ce-9fdf-93ab5f3b26ee

This is the call stack with external code. When the android device logger is enabled it shows out of memory errors. I have no idea to solve this and any help would be appreciated!

1
Show your work and error message as a text, not as an image. - Soner Gönül
Added the error as text. - Jos
Need code to be certain but it looks pretty straight forward. You are loading a large bitmap or leaking an image. - ClintL

1 Answers

0
votes

Are you using a Backgroundimage or another Image inside your Pages?

I had the same issue. I resolved it by loading/unloading backgroundimage from pages on navigation:

public override OnAppearing(...) { this.backgroundimage.Source = null; }
public override OnDisappearing(..) { this.backgroundimage.Source = your ImageSource; }

Big backgroundimages caused crashes in my android app. the ios version seemed to be handling it throwing no exception.