使用firebase_ml_vision时出现抖动错误

时间:2020-11-03 11:56:54

标签: flutter firebase-mlkit

当我在pubspec.yaml文件中使用或添加firebase_ml_vision时,我的应用程序显示这些错误。

如果我在pubspec yaml中删除firebase_ml_vision,则一切正常。

我刚刚完成了从集成Firebase到将implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.1.1'添加到a​​pp / build.gradle的所有过程。

但我只是停留在这里。

我不知道如何解决。

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.1.
  0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

  Dependency failing: com.google.android.gms:play-services-vision-image-label:18.0.4 -> com.google.android.gms:play-servic
  es-vision-common@[19.1.0], but play-services-vision-common version was 19.1.2.
                                                                                
  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.
  -- Project 'app' depends onto com.google.firebase:firebase-ml-vision@{strictly 24.1.0}
  -- Project 'app' depends onto com.google.android.gms:play-services-vision-common@{strictly 19.1.2}
  -- Project 'app' depends on project 'firebase_ml_vision' which depends onto com.google.firebase:firebase-ml-vision@20.0.
  0
  -- Project 'app' depends onto com.google.android.gms:play-services-mlkit-text-recognition@{strictly 16.1.1}
  -- Project 'app' depends onto com.google.android.gms:play-services-mlkit-text-recognition@16.1.1
  -- Project 'app' depends onto com.google.firebase:firebase-bom@26.0.0 
  -- Project 'app' depends onto com.google.android.gms:play-services-vision-image-label@{strictly 18.0.4}
  -- Project 'app' depends onto com.google.firebase:firebase-bom@{strictly 26.0.0}
  -- Project 'app' depends onto com.google.android.gms:play-services-vision@{strictly 20.1.2}

  For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
  endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
  github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = true }" to your bu
  ild.gradle file.

我在项目级别的build.gradle

buildscript {
    '''
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.4'
    }
}

我的build.gradle在应用程序级别

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

'''
android {
    '''
    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        '''
        minSdkVersion 21
        targetSdkVersion 28
        '''
    }
    '''
}
'''
dependencies {
   '''
    implementation platform('com.google.firebase:firebase-bom:26.0.0')
    implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.1.1'
}

3 个答案:

答案 0 :(得分:0)

我设法使用firebase-bom:24:0.0而不是26:0.0解决了类似的问题。

答案 1 :(得分:0)

我们对Firebase ML Kit进行了一些更改,以更好地区分设备上的API和基于云的API。 “ ML Kit”(没有firebase品牌)包含所有设备上的API。 Here's从Firebase mlkit到mlkit的迁移指南。

对于此特定的依赖关系问题,firebase mlkit依赖关系存在一个已知问题。有一个解释here

删除firebase mlkit的愿景,取决于com.google.android.gms:play-services-mlkit-text-recognition:16.1.1并使用MLKit API应该是正确的选择。

答案 2 :(得分:0)

我遇到了同样的问题。 试过

gradle-6.1.1-all.zip, 
implementation 'com.google.android.gms:play-services-vision:20.1.2'
implementation 'com.google.android.gms:play-services-vision-common:19.1.2'
implementation 'com.google.android.gms:play-services-vision-image-label:18.1.0'

有关此问题的任何最新消息吗?