Reputation: 31
I am trying to select photos using the Capacitor/Camera plugin. But the code fails while building for Android.
this is my function to call the camera Intent:
import { Camera, CameraResultType } from '@capacitor/camera';
async takePicture() {
const image = await Camera.getPhoto({
quality: 90,
allowEditing: true,
resultType: CameraResultType.Uri
});
// image.webPath will contain a path that can be set as an image src.
// You can access the original file using image.path, which can be
// passed to the Filesystem API to read the raw data of the image,
// if desired (or pass resultType: CameraResultType.Base64 to getPhoto)
this.avatarUrl = image.webPath;
};
This is the build error I am facing:
My Environment version:
npm: 8.17.0
node: 18.7.0
angular: 14.0.5
ionic: 6.20.1
@camera/capacitor: 4.1.0
Upvotes: 1
Views: 1447
Reputation: 11
It seems the plugin has some issues or something is not covered in jetify. I also had the same issue. Try this https://ionicframework.com/docs/native/camera This works for me
Upvotes: 0