【发布时间】:2020-11-03 11:56:54
【问题描述】:
当我在 pubspec.yaml 文件中使用或添加 firebase_ml_vision 时,我的应用会显示这些错误。
如果我在 pubspec yaml 中删除 firebase_ml_vision,一切都会好起来的。
我只是按照从集成 firebase 到将 implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.1.1' 添加到 app/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'
}
【问题讨论】:
-
这可能是由于 play-services-mlkit-text-recognition 和 firebase_ml_vision 对 play-services-vision-common 的版本要求不同。为什么两者都需要?后一种已被新的 ML Kit 弃用。 developers.google.com/ml-kit/migration/android