onGoogleVisionBarcodesDetected 错误 React Native

问题描述

我正在尝试使用 react native 实现 google mlkit 条形码扫描仪,但是当我尝试执行 onGoogleVisionBarcodesDetected 时,它在应用程序上抛出错误:找不到 com.google.android.gms.internal.zzbgl 的类文件

这是我的代码

 <RNCamera
        style={styles.preview}
        onBarCodeRead={this.onBarCodeRead}
        onGoogleVisionBarcodesDetected={(e) => {
          console.warn(e);
        }}
        captureAudio={false}
        ref={(cam) => (this.camera = cam)}
        // aspect={RNCamera.constants.Aspect.fill}
      >
        <Text
          style={{
            backgroundColor: 'white',}}>
          BARCODE SCANNER
        </Text>
      </RNCamera>

这是我的依赖项

    dependencies {
    implementation filetree(dir: "libs",include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
implementation 'com.android.support:multidex:1.0.3'

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    implementation "com.google.firebase:firebase-auth:17.0.0"


compile ("com.google.android.gms:play-services-vision:10.2.0") {
  force = true;
}
implementation project(':react-native-firebase')
implementation "com.google.android.gms:play-services-base:10.2.0"
implementation "com.google.firebase:firebase-core:16.0.1"

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3',module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

我也在底部添加

apply plugin: 'com.google.gms.google-services'

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)