安装React-Native-camera

时间:2018-05-09 16:25:35

标签: android react-native google-play-services react-native-android react-native-camera

我在连接react-native-camera之后尝试构建我的项目。 我认为问题来自依赖关系和谷歌播放服务,但我不确定。

我尝试了许多其他配置,即使构建错误不同,我也无法构建......

我遇到的最后一个错误是:

  

Android依赖'com.google.android.gms:play-services-base'有   编译(11.8.0)和运行时(12.0.1)的不同版本   类路径。您应该通过手动设置相同的版本   DependencyResolution

这些是我得到的依赖:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation project(':tipsi-stripe')
    implementation "com.facebook.react:react-native:+"
    implementation project(':react-native-maps')
    implementation project(':react-native-camera')
    implementation 'com.google.firebase:firebase-core:10.0.1'
    implementation "com.android.support:appcompat-v7:23.0.1"
    implementation 'com.google.android.gms:play-services-base:10.0.1'
    implementation 'com.google.android.gms:play-services-maps:10.0.1'
}

2 个答案:

答案 0 :(得分:0)

这在github forum中进行了讨论,提供的解决方案是在依赖项中使用编译“com.google.android.gms:play-services-vision:11.8.0”:

dependencies {
  compile 'com.facebook.react:react-native:+'
  compile "com.google.zxing:core:3.2.1"
  compile "com.drewnoakes:metadata-extractor:2.9.1"
  compile 'com.google.android.gms:play-services-vision:11.8.0'
  compile "com.android.support:exifinterface:+"

  compile 'com.github.react-native-community:cameraview:cc47bb28ed2fc54a8c56a4ce9ce53edd1f0af3a5'
}

答案 1 :(得分:0)

请关注:React-Native-Camera

在它之上按照以下步骤操作: App Gradle:

dependencies {
    compile project(':react-native-camera')
    api project(':react-native-vector-icons')
    api project(':react-native-i18n')
    api fileTree(include: ['*.jar'], dir: 'libs')
    api 'com.android.support:appcompat-v7:26.0.1'
    api 'com.facebook.react:react-native:+'
    // From node_modules
}

Project Gradle低于所有项目:

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }
        }
    }
}

如果仍然遇到此插件的问题,请告诉我。