Tapas Mukherjee
Tapas Mukherjee

Reputation: 2178

Capacitor js Camera plugin error Out of memory in Android

In my Ionic 5 app, I am using @capacitor/camera plugin. Following in the code.

let camOption: CameraOptions = {
  quality: 100,
  resultType: CameraResultType.Base64,
  source: CameraSource.Photos
}

try {
  const result = await Camera.getPhoto(camOption);
} catch (error) {
  console.log(JSON.stringify(error));
}

When selecting a large image of a size of more than 10MB, I am getting the error {"message":"Out of memory"} after few seconds of screen freeze. I see other Out of memory errors reported by users but not sure how to fix this scenario.

Upvotes: 1

Views: 677

Answers (1)

sultanmyrza
sultanmyrza

Reputation: 5464

Working with large files may require you to add android:largeHeap="true" to the tag in AndroidManifest.xml.

Try to add android:largeHeat="true" so you Androidanifest.xml shoul look like

enter image description here

Upvotes: 0

Related Questions