首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将'com.google.gms.google-services‘插件与android应用程序集成时出现问题

将'com.google.gms.google-services‘插件与android应用程序集成时出现问题
EN

Stack Overflow用户
提问于 2020-07-23 22:00:48
回答 3查看 1.9K关注 0票数 2

当我尝试将应用插件'com.google.gms.google-services‘放在build gradle的底部或应用程序build gradle中的任何其他位置时,我得到了以下错误:

代码语言:javascript
复制
In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.0.
2]", 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.3 -> com.google.android.gms:play-servic
es-vision-common@[19.0.2], but play-services-vision-common version was 19.1.0.

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-object-detection-model@{strictly 19.0.5}
-- Project 'app' depends onto com.google.android.gms:play-services-vision-common@{strictly 19.1.0}
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision@{strictly 24.0.3}
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision-internal-vkp@{strictly 17.0.1}
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision-object-detection-model@19.0.5
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision@24.0.3
-- Project 'app' depends onto com.google.android.gms:play-services-vision-image-label@{strictly 18.0.3}
-- Project 'app' depends onto com.google.android.gms:play-services-mlkit-face-detection@16.1.0
-- Project 'app' depends onto com.google.android.gms:play-services-vision@{strictly 20.1.0}
-- Project 'app' depends onto com.google.android.gms:play-services-mlkit-face-detection@{strictly 16.1.0}

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 = false }" to your b
uild.gradle file.

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

代码语言:javascript
复制
apply plugin: 'com.android.application'
android {
    compileSdkVersion 30
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.example.mlkitfacedetection"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}


dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'com.google.android.gms:play-services-mlkit-face-detection:16.1.0'
    implementation 'com.google.firebase:firebase-ml-vision:24.0.3'
    implementation 'com.google.firebase:firebase-ml-vision-object-detection-model:19.0.5'
    def camerax_version = "1.0.0-beta03"
// CameraX core library using camera2 implementation
    implementation "androidx.camera:camera-camera2:$camerax_version"
// CameraX Lifecycle Library
    implementation "androidx.camera:camera-lifecycle:$camerax_version"
// CameraX View class
    implementation "androidx.camera:camera-view:1.0.0-alpha10"
}
apply plugin: 'com.google.gms.google-services'

我无法解决此错误。在另一个应用程序中,相同的代码运行得非常好。我使用的是来自firebase上注册的另一个应用程序的google-servvices.json文件。这难道不是问题的原因吗?

EN

回答 3

Stack Overflow用户

发布于 2020-07-25 03:47:14

我测试了这个变通方法,它似乎起作用了。在您的dependencies块中添加以下内容:

代码语言:javascript
复制
implementation 'com.google.android.gms:play-services-vision-image-label:18.0.4'
票数 2
EN

Stack Overflow用户

发布于 2020-11-22 19:25:35

代码语言:javascript
复制
implementation 'com.google.android.gms:play-services-vision:20.1.1'
implementation 'com.google.android.gms:play-services-vision-common:19.1.1'
implementation "com.google.android.gms:play-services-vision-face-contour-internal:16.0.2"
implementation 'com.google.android.gms:play-services-vision-image-label:18.0.5'
implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
代码语言:javascript
复制
implementation 'com.google.firebase:firebase-ml-vision-face-model:20.0.2'
代码语言:javascript
复制
implementation 'com.google.firebase:firebase-ml-model-interpreter:22.0.4'
implementation 'org.tensorflow:tensorflow-lite:2.0.0'

单击此链接了解更多详细信息- https://github.com/firebase/firebase-android-sdk/issues/1904

票数 1
EN

Stack Overflow用户

发布于 2021-11-29 04:58:05

您可能只需要更新您的依赖项:文件-->项目结构-->依赖项然后在下半部分,您将看到任何需要updating...Worked的依赖项

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63056088

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档