Capacitor Camera throwing "Unable to create photo on disk" on Android 5


The capacitor camera plugin works great on Android 8+ devices, but for some reason, it throws the below error on a Samsung Tab A(SM-T280) running on Android 5.


const image = await Plugins.Camera.getPhoto({
  quality: 100,
  allowEditing: false,
  resultType: CameraResultType.Base64,
  source: CameraSource.Camera


enter image description here


The issue is caused because the directory is not created.

The fix to this is to add storageDir.mkdirs(); after this code in the repo. The answer is referenced from cordova-camera-plugin code

This issue is resolved in Pull Request #2016

Answered By – Nidhin Joseph

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published