kennemat
kennemat

Reputation: 190

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

I see that this is a common issue apparently, but none of the posted solutions work for me. I have checked and all of my play services and firebase libraries are at the latest version.

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 project:

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
}

I have tried commenting out the dependencies as well, and I get a different error (Unexpected end of ZLIB input stream)

Upvotes: 4

Views: 8531

Answers (3)

beck
beck

Reputation: 3027

Using the latest version of the library works com.google.firebase:firebase-core:16.0.9

find the latest version frm maven: https://dl.google.com/dl/android/maven2/index.html

Upvotes: 2

Martin Zeitler
Martin Zeitler

Reputation: 76639

most likely ...without knowing what might be in the libs directory:

dependencies {
    implementation "com.google.android.gms:play-services-base:16.0.1"
    implementation (fileTree(dir: "libs", include: ["*.jar"])) {
        exclude group: "com.google.android.gms"
    }
}

or enforce the version to select:

configurations.all() {
    resolutionStrategy.force "com.google.android.gms:play-services-base:16.0.1"
}

Upvotes: 0

shizhen
shizhen

Reputation: 12583

Option 1

Downgrade your google service version to 3.2.1

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

Option 2

right after the apply plugin: 'com.google.gms.google-services' at the bottom of your build.gradle the following can be added to work around the issue.

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

Upvotes: 14

Related Questions