Ionic Android中的离子电容器相机插件构建错误

szqfcxe2  于 2022-12-16  发布在  Ionic
关注(0)|答案(1)|浏览(146)

我正在尝试使用电容器/相机插件选择照片。但是代码在为Android构建时失败。
这是我调用摄像头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;
  };

这是我面临的构建错误:

我的环境版本:

npm: 8.17.0

node: 18.7.0

angular: 14.0.5

ionic: 6.20.1

@camera/capacitor: 4.1.0
1sbrub3j

1sbrub3j1#

看起来插件有一些问题或者jetify没有包含的东西。我也有同样的问题。试试这个https://ionicframework.com/docs/native/camera这个对我很有效

相关问题