库com.google.android.gms:[[15.0.1,15.0.1]]的各种其他图书馆正在请求播放服务地下室,但已解析为16.0.1

问题描述 投票:4回答:1

同步项目时出现此错误:

com.google.android.gms库:play-services-basement正在[[15.0.1,15.0.1]]的各个其他图书馆请求,但已解析为16.0.1。

禁用插件并使用./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'])
}

这是我得到的错误:

错误:找不到符号类IFlagProvider

android firebase android-gradle google-play-services
1个回答
3
投票

这些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。

© www.soinside.com 2019 - 2024. All rights reserved.