【问题标题】:Gradle sync fails - play-services-measurement-base is being requested by various other librariesGradle 同步失败 - 其他各种库正在请求 play-services-measurement-base
【发布时间】:2018-10-10 08:40:00
【问题描述】:

添加“ implementation 'com.google.android.gms:play-services-ads:17.0.0' ”库后,我遇到了这个问题。我尝试将每个依赖项升级到最新版本,但没有成功。

库 com.google.android.gms:play-services-basement 正在 [[15.0.1,15.0.1]] 的各种其他库请求,但解析为 16.0.1。禁用插件并使用 ./gradlew :app:dependencies 检查你的依赖树。

这是我的 build.gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.hussain.podcastapp"
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}

dependencies {
    def room_version = "1.1.1"

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.github.devlight.navigationtabstrip:navigationtabstrip:1.0.4'
    implementation 'com.squareup.retrofit2:converter-simplexml:2.3.0'
    implementation 'com.github.florent37:glidepalette:2.1.2'
    implementation 'com.android.support:palette-v7:27.1.1'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.airbnb.android:lottie:2.6.1'
    implementation "com.mikepenz:materialdrawer:6.0.9"
    implementation 'com.google.android.exoplayer:exoplayer-core:2.8.1'
    implementation 'com.google.android.exoplayer:exoplayer-dash:2.8.0'
    implementation 'com.google.android.exoplayer:exoplayer-ui:2.8.1'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation 'com.google.firebase:firebase-database:16.0.3'
    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version"
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.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'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.google.android.gms:play-services-ads:17.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
}
apply plugin: 'com.google.gms.google-services'

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

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        classpath 'com.google.gms:google-services:4.1.0'

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

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

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

依赖项更新为最新版本。

【问题讨论】:

  • 设置com.google.android.gms:play-services-ads:16.0.0

标签: android android-studio gradle android-gradle-plugin google-play-services


【解决方案1】:

尝试添加:

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

在底部的build.gradle 之后:

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

检查this link

还有this link。它可能与版本有相同的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-07
    • 1970-01-01
    • 1970-01-01
    • 2018-12-24
    • 2019-04-01
    • 1970-01-01
    • 2019-09-25
    相关资源
    最近更新 更多