I’m working on a project that his main core is take a lot of pictures. App crashes randomly only when take photos, almost all views displays a modal that can take 4 photos, and when the photo is taken the app closes unexpectedly.
We constantly send and receive images from the modal to main components.
When the Camera is Open Android Studio launch a lot of errors without stopping, I will provide a picture of these errors.
Capacitor Doctor
Latest Dependencies:
@capacitor/cli: 2.4.6
@capacitor/core: 2.4.6
@capacitor/android: 2.4.6
@capacitor/electron: 2.4.6
@capacitor/ios: 2.4.6
Installed Dependencies:
@capacitor/ios not installed
@capacitor/cli 2.4.6
@capacitor/android 2.4.6
@capacitor/core 2.4.6
@capacitor/electron not installed
Our camera Service
public async takePhoto() {
return new Promise(async (resolve, reject) => {
// Take a photo
const capturedPhoto = await Camera.getPhoto({
resultType: CameraResultType.Uri, // file-based data; provides best performance
source: CameraSource.Camera, // automatically take a new photo with the camera
quality: 50 // highest quality (0 to 100)
});
if (capturedPhoto) {
// Save the picture and add it to photo collection
const savedImageFile = await this.savePicture(capturedPhoto);
// this.photos.unshift(savedImageFile);
resolve(savedImageFile);
} else {
reject();
}
});
}