【问题标题】:Impossible to build after installing React-Native-camera安装 React-Native-camera 后无法构建
【发布时间】:2018-05-09 16:25:34
【问题描述】:

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

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

我的最后一个错误是:

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

这些是我得到的依赖项:

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

【问题讨论】:

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


    【解决方案1】:

    github forum 对此进行了讨论,提供的解决方案是在您的依赖项中使用 compile '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'
    }
    

    【讨论】:

    • 我通过添加 gms 的排除来修复它,我没有添加 play-services-vision
    【解决方案2】:

    请关注:React-Native-Camera

    除此之外,请按照以下步骤操作: 应用 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"
                }
            }
        }
    }
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多