0

在链接 react-native-camera 之后,我整天都在尝试构建我的项目。我认为问题出在依赖项和 google-play-service 但我不确定。

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

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

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'
}
4

2 回答 2

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
}

所有项目下的项目 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"
            }
        }
    }
}

让我知道是否仍然遇到此插件的问题。

于 2018-05-27T19:32:50.663 回答
0

这在此github 论坛com.google.android.gms:play-services-vision:11.8.0中进行了讨论,提供的解决方案是在您的依赖项中使用 compile ' ':

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'
}
于 2018-05-10T08:51:40.940 回答