react-native 实现扫描二维码或拍照上传(react-native-camera)

本文介绍了在react-native项目中使用react-native-camera插件实现拍照上传和扫描二维码功能,详细讲述了安装过程、可能出现的异常及其解决方案,包括在android和ios平台的文件配置。参考文章链接:https://www.jianshu.com/p/727c9d4c080c。
摘要由CSDN通过智能技术生成

react-native 实现拍照上传及扫描二维码功能

自从入了rn项目的坑,开始了踩坑历程,下面总结一下拍照上传遇见的坑:
使用的主要插件是:react-native-camerareact-native-image-picker

“react-native”: “0.59.9”
“react-native-camera”: “git+https://git@github.com/react-native-community/react-native-camera”
“react-native-image-picker”: “^2.3.1”

安装 react-native-camera

  1. 安装步骤这里省略,按照 npm 安装步骤没什么问题:npm安装步骤
    P.S. 我这里的rn版本 < 0.60.x, 所以安装完成之后需要 react-native link 一下
  2. 但是安装完成之后会遇见各种报错问题,下面汇总一下安装出现的问题及解决方式

安装报错问题汇总处理

异常 1
 What went wrong:
 Could not determine the dependencies of task ':app:preDebugBuild'.

 > Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
 > Could not resolve project :react-native-camera.

      Required by:
          project :app
       > Cannot choose between the following variants of project :react-native-camera:
           - generalDebugRuntimeElements
           - mlkitDebugRuntimeElements
         All of them match the consumer attributes:
           - Variant 'generalDebugRuntimeElements' capability baidupush:react-native-camera:unspecified:
               - Unmatched attributes:
                   - Found com.android.build.api.attributes.VariantAttr 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值