com.google.android.gms:play-services-basement 正在被 [[15.0.1,15.0.1]] 上的各种其他库请求,但解析为 16.0.1

library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1

同步项目时出现此错误:

The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1.

Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

这是我的 build.gradle 项目文件:

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

buildscript {

repositories {
    google()
    jcenter()
    maven {
        url 'https://maven.fabric.io/public'
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.1.0'
    classpath 'io.fabric.tools:gradle:1.25.4'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

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

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

这是我的 build.gradle 应用程序文件:

import com.google.gms.googleservices.GoogleServicesPlugin

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 27
defaultConfig {
    multiDexEnabled true
    applicationId "com.example.myexampleapp"
    minSdkVersion 19
    targetSdkVersion 27
    versionCode 13
    versionName "0.1.13"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-firestore:17.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.firebaseui:firebase-ui-firestore:4.1.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'

我试过的:

感谢您的帮助!

更新: 这是我目前在依赖项中的内容:

dependencies {
api "com.android.support:appcompat-v7:28.0.0"
api "com.android.support:customtabs:28.0.0"
api "com.android.support:support-v4:28.0.0"
api "com.android.support:cardview-v7:28.0.0"
api "com.android.support:design:28.0.0"
api "com.android.support.constraint:constraint-layout:1.1.3"

api "com.crashlytics.sdk.android:crashlytics:2.9.5"
api "com.google.android.gms:play-services-base:16.0.1"
api "com.google.android.gms:play-services-auth:16.0.1"

api "com.google.firebase:firebase-core:16.0.5"
api "com.google.firebase:firebase-auth:16.0.5"
api ("com.google.firebase:firebase-firestore:17.1.2") {
    exclude group: "com.squareup.okhttp", module: "okhttp"
}
api ("com.firebaseui:firebase-ui-firestore:4.1.0") {
    exclude group: "com.google.code.gson", module: "gson"
}
api ("com.firebaseui:firebase-ui-auth:4.1.0") {
    exclude group: "com.google.code.gson", module: "gson"
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
}

这是我得到的错误:

error: cannot find symbol class IFlagProvider

这些 dependencies 构建:

dependencies {
    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation "com.android.support:customtabs:28.0.0"
    implementation "com.android.support:support-v4:28.0.0"
    implementation "com.android.support:cardview-v7:28.0.0"
    implementation "com.android.support:design:28.0.0"
    implementation "com.android.support.constraint:constraint-layout:1.1.3"

    implementation "com.google.android.gms:play-services-base:16.0.1"
    implementation "com.google.android.gms:play-services-auth:16.0.1"

    implementation "com.crashlytics.sdk.android:crashlytics:2.9.5"

    implementation "com.google.firebase:firebase-core:16.0.4"
    implementation "com.google.firebase:firebase-auth:16.0.4"

    implementation ("com.google.firebase:firebase-firestore:18.0.0") {
        exclude group: "com.squareup.okhttp", module: "okhttp"
        exclude group: "com.google.code.gson", module: "gson"
        // exclude group: "com.google.guava", module: "guava"
    }

    implementation ("com.firebaseui:firebase-ui-firestore:4.1.0") {
        exclude group: "com.google.code.gson", module: "gson"
    }

    implementation ("com.firebaseui:firebase-ui-auth:4.1.0") {
        exclude group: "com.google.code.gson", module: "gson"
    }
}

我添加了 customtabs:28.0.0 以满足所需的版本和 play-services-base:16.0.0(应作为传递依赖项获取)。还排除了重复的包,例如。 gson。使用 compileSdkVersiontargetSdkVersion 28.