android - 库 com.google.android.gms :play-services-base is being requested by various other libraries at [[15. 0.1,15.0.1]],但解析为 16.0.1

标签 android firebase android-gradle-plugin dependencies

我发现这显然是一个常见问题,但已发布的解决方案均不适合我。我已经检查过,我所有的播放服务和 firebase 库都是最新版本。

app/build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "jobquals"
        minSdkVersion 22
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-database:16.0.3'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    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'

}
//com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
apply plugin: 'com.google.gms.google-services'

build.gradle 项目:

buildscript {

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

我也试过注释掉依赖项,但我得到了一个不同的错误(Unexpected end of ZLIB input stream)

最佳答案

选项 1

将你的谷歌服务版本降级到 3.2.1

classpath 'com.google.gms:google-services:3.2.1'

选项 2

build.gradle 底部的 apply plugin: 'com.google.gms.google-services' 之后,可以添加以下内容来解决问题。

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

关于android - 库 com.google.android.gms :play-services-base is being requested by various other libraries at [[15. 0.1,15.0.1]],但解析为 16.0.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52979121/

相关文章:

android - 什么是 Firebase 远程配置开发者模式

android - 无法在 Firebase Analytics : Screen name (not set) 中跟踪屏幕名称

javascript - Firebase 函数算法 onWrite

Android Gradle : rename/disable default build type

android - 运行官方教程时"Duplicate resources"

java - 强制加载移动 Youtube 页面?

android - Firebase 数据库安卓

android - 没有 Firebase 的集成 AdMob : unwanted permissions (C2D)

安卓 Gradle : archive output directory in Jenkins

android - 是否可以在 android 上同时记录视频和加速度计数据?