Hi Everyone,
I try to make a use of MediaPicker in Xamarin Forms and it works perfectly on iOS and Windows Phone but it crashes on Android.
It crashes wo no exception whatsoever as the Exception is null in the catch block.
I have a little more info in the output Window but I don't know what to do with this:
The class Android.OS.BaseBundle could not be loaded, used in XLabs.Platform.Droid
It have declared the permissions documented in my Android project :
Dependency Injection with SimpleInjector works fine and I have an instance of MediaPicker in my class.
Here's the failing code :
try
{
var options = new CameraMediaStorageOptions {DefaultCamera = CameraDevice.Front, MaxPixelDimension = 400};
// It crashes here on Android. _mediaPicker is injected by constructor and has a non-null value.
var mediaFile = await _mediaPicker.SelectPhotoAsync(options);
var imageSource = ImageSource.FromStream(() => mediaFile.Source);
ImageSource = imageSource;
}
catch (Exception ex)
{
// ex is null following the crash
Debug.WriteLine(ex.Message);
}
I use the last version of Xamarin on the Beta Channel.
The bug is reproduced on various emulator and on a Galaxy S4 Device.
Any idea to fix this issue is welcomed.
Thanks