微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

onGoogleVisionBarcodesDetected 错误 React Native

如何解决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 举报,一经查实,本站将立刻删除。