当前位置: 首页 > 知识库问答 >
问题:

错误:在“应用程序”项目中,一个已解决的Google Play services库依赖项依赖于另一个精确版本的库

彭华皓
2023-03-14

当我试图html" target="_blank">编译我的项目时,我得到了以下错误

错误:在“应用程序”项目中,已解决的Google Play services库依赖项依赖于另一个精确版本(例如“[15.0.1]”),但未解决到该版本。库显示的行为将是未知的。

apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.spars.myapplication"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    mavenCentral()
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.razorpay:checkout:1.4.5'
    implementation 'com.google.firebase:firebase-database:16.0.6'
    implementation 'com.firebaseui:firebase-ui:3.3.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    testImplementation 'junit:junit:4.12'
    //add start
    implementation "android.arch.lifecycle:extensions:1.1.1"
// Multidex
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-analytics:16.3.0'
    //add finish
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:cardview-v7:23.3.0'

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

//added part xxx
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '27.1.1'
            }
        }
    }

}

Build.Gradle(项目)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven{
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我得到以下错误

错误:在“应用程序”项目中,已解决的Google Play services库依赖项依赖于另一个精确版本(例如“[15.0.1]”),但未解决到该版本。库显示的行为将是未知的。

对于扩展调试信息,从命令行执行Gradle,使用。/gradlew--info:app:assembleDebug查看工件的dep endency路径。此错误消息来自google-services Gradle插件,在https://github.com/google/play-services-plugins上报告问题,并通过向build.Gradle文件添加“GoogleServices{disableVersionCheck=false}”来禁用。

请帮忙

共有1个答案

朱翔
2023-03-14

此问题可能是由于Firebase UI版本与正在使用的Firebase其他依赖项的版本不兼容(其他依赖项需要更高的Google Play Services版本)造成的。

如果您查看这里,您将看到Firebase UI需要哪些版本。

也许您应该考虑更新您的Firebase UI版本,因为当前的版本是4.3.1

 类似资料:
  • 对于扩展调试信息,从命令行执行Gradle,使用。/gradlew--info:app:assembleDebug查看工件的dep endency路径。此错误消息来自google-services Gradle插件,在https://github.com/google/play-services-plugins上报告问题,并通过向build.Gradle文件添加“GoogleServices{di

  • 我有一个应用程序运行良好,但今天它在构建项目时出现了错误。我花了一整天的时间,尝试了太多来自stack的解决方案。什么都没用。 我有以下应用程序- build.gradle是 在建筑项目上,我遇到了这个错误 错误:在项目“app”中,已解析的Google Play services库依赖于另一个精确版本(例如“[20.0.2]”),但未解析为该版本。库显示的行为未知。 依赖项失败:com。谷歌。f

  • > 嗨,我正在实施Firebase崩溃analytics.when我在我的项目中添加了Firebase sdk,这些错误显示。我被困在这个日志时间,我试图降低实现,但它显示了另一个错误。所以你能解决这个问题me.below添加了构建错误和gradlecode.so可以请解决这个问题。 在org.gradle.api.internal.tasks.execution.CatchExceptionTa

  • 本文向大家介绍gradle 依赖于另一个Gradle项目,包括了gradle 依赖于另一个Gradle项目的使用技巧和注意事项,需要的朋友参考一下 示例 对于多项目gradle构建,有时可能需要依赖构建中的另一个项目。为此,请在项目的依赖项中输入以下内容: ':OtherProject'从目录结构的根引用的项目gradle路径在哪里。 为了':OtherProject'在build.gradle文

  • 免责声明:我是使用Ant Ivy的新手 我有以下eclipse配置: 项目A取决于项目B和项目C 项目B依赖于项目C 每个项目都有自己的ivy.xml文件。 ProjectA有一个生成。xml文件,如下所示: 因此,运行这个build.xml会导致错误,说ProjectC无法编译,因为它缺少一个*。应该由ivy:resolve命令解析的jar文件。 我的问题是: < li >如何创建一个build

  • 我面临着以下问题。我有两个Gradle项目(ProjectA和ProjectB)在同一个层次结构上,没有任何根项目。由于ProjectA依赖于ProjectB,我尝试将其建模如下: ProjectA的settings.gradle: ProjectA的build.gradle: 然而,当我在ProjectA上执行gradle build时,我得到了以下错误: 我必须在ProjectB中定义某种默认