Search code examples
cordovaionic-frameworkionic4capacitor

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.

Configuration

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

Error

enter image description here


Solution

  • 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