【问题标题】:react-native-camera build error on androidandroid上的react-native-camera构建错误
【发布时间】:2018-04-25 14:49:53
【问题描述】:

您好,我正在使用以下堆栈: - 反应原生相机 1.1.1 - 反应原生 0.55.3 - 毕业 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
        }
    }
}

感谢您的帮助!

【问题讨论】:

    标签: android react-native gradle react-native-camera camera-view


    【解决方案1】:

    通过从 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
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-08-31
      • 2020-06-28
      • 1970-01-01
      • 2017-06-26
      • 1970-01-01
      • 1970-01-01
      • 2017-11-19
      相关资源
      最近更新 更多