android - android上的react-native-camera构建错误
问题描述
嗨,我正在使用以下堆栈: - react-native-camera 1.1.1 - react-native 0.55.3 - gradle 3.1.2
我完成了文档中描述的所有步骤来链接项目(https://github.com/react-native-community/react-native-camera)。
gradle 同步成功结束,但是当我尝试构建项目时出现很多错误:
/node_modules/react-native-camera/android/src/main/java/org/reactnative/camera/RNCameraView.java:15: error: package com.google.android.cameraview does not exist
导入 com.google.android.cameraview.CameraView;
其他错误看起来相同(找不到CameraView)...
这是我的gradle文件:
dependencies {
compile project(':react-native-video')
implementation project(':react-native-vector-icons')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-languages')
implementation project(':react-native-i18n')
implementation project(':react-native-background-timer')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.+"
implementation "com.facebook.react:react-native:+" // From node_modules
compile (project(':react-native-camera')) {
compile 'com.android.support:exifinterface:27.+'
compile ('com.google.android.gms:play-services-vision:12.0.1') {
force = true
}
}
}
谢谢你的帮助!
解决方案
通过从 react-native-camera 中排除 com.android.support 来解决它:
compile (project(':react-native-camera')) {
exclude group: "com.google.android.gms"
exclude group: "com.android.support" // --> this line
compile 'com.android.support:exifinterface:27.+'
compile ('com.google.android.gms:play-services-vision:12.0.1') {
force = true
}
}
推荐阅读
- python - 如何根据 Django admin list_display 中的模型值从自定义数据库查找中返回值?
- angular - Angular 8 有没有办法在每次击键时停止触发按钮上的 [disabled]="somefunc()" 功能?
- php - 如何生成一个随机数数组并使用 php 对该数组进行排序?
- flutter - Flutter - NumberFormat.compactCurrency() 的倒数
- html - 在 XSLT 中将后代标签显示为标签
- flutter - Flutter - 如何在流构建器中使用 await?
- flutter - Flutter - 如何在不使用 SteamBuilder 的情况下使用从 FireStore 检索到的数据?
- java - Firestore:如何在整个数据库中搜索?
- c - CLion 未在终端中运行
- bash - 如何每次在相同的 shell 环境中运行 crontab