war*_*rts 4 android build.gradle android-gradle-plugin

当我尝试编译我的项目时,我遇到了以下错误

错误:在项目“应用程序”中,已解析的 Google Play 服务库依赖项依赖于另一个确切版本(例如“[15.0.1]”,但未解析为该版本。库表现出的行为将是未知的。

build.gradle(应用程序)

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'
            }
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

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
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

错误:在项目“应用程序”中,已解析的 Google Play 服务库依赖项依赖于另一个确切版本(例如“[15.0.1]”,但未解析为该版本。库表现出的行为将是未知的。

依赖失败:com.google.android.gms:play-services-flags:15.0.1 -> com.google.android.gms:play-services-basement@[ 15.0.1],但 play-services-basement 版本是16.0.1。

以下依赖项是项目依赖项,它们是直接的或具有导致问题的艺术 ifact 的传递依赖项。-- 项目“app”依赖于 com.google.firebase:firebase-firestore@15.0.0 -- 项目“app”依赖于 com.google.firebase:firebase-storage-common@15.0.0 -- 项目“app”取决于 com.google.firebase:firebase-common@16.0.4——“app”项目取决于 com.google.android.gms:play-services-basement@16.0.1——“app”项目取决于 com。 firebaseui:firebase-ui-database@3.3.1——“app”项目依赖于 com.google.firebase:firebase-auth@15.0.0——“app”项目依赖于 com.google.android.gms:play- services-tasks@16.0.1 -- 项目“app”依赖于 com.firebaseui:firebase-ui-auth@3.3.1 -- 项目“app”

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

请帮忙