![](/img/trans.png)
[英]react-native-camera (android): takePictureAsync() throws error
[英]react-native-camera build error on android
嗨,我正在使用以下堆棧:-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
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.