jamesmontemagno / MediaPlugin

Take & Pick Photos and Video Plugin for Xamarin and Windows
MIT License
711 stars 360 forks source link

Bitmap decode on the image file path returned by TakePhoto ( reproducible only on Android 11 ) #914

Closed aquakul closed 2 years ago

aquakul commented 3 years ago

Version Number of Plugin: 4.0.1.5 Device Tested On: Samsung Galaxy S20 Simulator Tested On: NA Version of VS: MS VS 2019 Enterprise 16.8.3 Version of Xamarin: Xamarin Android 9 Versions of other things you are using: Android OS 11

Steps To reproduce -

  1. Launch Camera using Mediapicker.TakePhotoAsync()
  2. Click a photo and return to App.

Actual Behavior - Cannot read bitmap from the path returned by Mediapicker.TakePhotoAsync() The API used to decode the bitmap at the path is - BitmapFactory.DecodeFile(/**/)

Expected behavior - Failed to load bitmap from the path. BitmapFactory.DecodeFile(/**/) returns null.

Code Snippet - var opts = new StoreCameraMediaOptions { Name = "TestImage", Directory = "TestImages" };

var camera = new MediaPicker(/ Android Activity instance/); MediaFile file = await camera.TakePhotoAsync(opts);

var b = BitmapFactory.DecodeFile(file.Path);

// The above function call returns null and the following error is seen on logs // Failed to create image decoder with message 'unimplemented'

PS - This issue is noticed only on Android devices running on Android 11. Have not yet tried with the latest Plugin version as it needs the migration to Android X.

jamesmontemagno commented 2 years ago

Please upgrade to latest beta and androidx