Could not find play-services-basement.aar

GradleGoogle Play-Services

Gradle Problem Overview


Yesterday I tried building my app and everything worked fine.

Today, without any changes to the project... All of a sudden I'm greeted with this warning message telling me:

Error:Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:11.0.1). 
Searched in the following locations:
    https://jcenter.bintray.com/com/google/android/gms/play-services-basement/11.0.1/play-services-basement-11.0.1.aar

Is anyone experiencing the same sort of issue?

If you follow the link where it's searching for the package it basically gets downloaded instantly through the browser. I suppose something has changed on the server side? Perhaps naming conventions?

It looks like it's looking for: play-services-basement.aar and fetches play-services-basement-11.0.1.aar instead? Could this be a naming convention or gradle issue?

Gradle Solutions


Solution 1 - Gradle

jcenter() has had mirrors of some libraries (I guess they are doing intentionally) that should originally available through google() or maven() repositories. When gradle build works, for any library that is used in the project the first place to look for is the repository that is listed first in repositories {.. When the jcenter() mirror does not have the release (e.g com.google.android.gms:play-services-ads:15.0.1 for my case) your gradle is looking for, the build fails with such error.

So, jcenter() should be listed at the last place in repositories {.. parts as below.

   buildscript {
    ext.kotlin_version = '1.2.50'
    repositories {
        google()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter()
    }...

and

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

Solution 2 - Gradle

This is crazy!!! I faced the same issue. The builds were working fine and then suddenly started to fail with the same issue. I tried the suggestions above but it didn't work for me. Finally, this is what worked for me:

Update to latest firebase dependencies:

> implementation 'com.google.firebase:firebase-core:16.0.4' > implementation 'com.google.firebase:firebase-ads:17.0.0'

also, the ads services:

> implementation 'com.google.android.gms:play-services-ads:17.0.0'

Note: with play-services-ads:17.0.0, it mandatory to add the following in the Manifest file, otherwise application crashes on opening.

> > > android:name="com.google.android.gms.ads.APPLICATION_ID" > android:value="[ADMOB_APP_ID]"/> >

Solution 3 - Gradle

UPDATE #2 2018/05/29

The issue looks to be fixed gone now, and I'm still using the same gradle configs. But I did these steps a while ago I'm not sure if these did anything or if this is a server-side issue and it got fixed/updated recently. I just noticed the issue was gone after I did the following steps:

> 1. Add the following in project-level gradle.build's buildscript > repositories and allprojects > repositories. > - google() > - maven { url 'http://jcenter.bintray.com' }

> 2. Change the google-services classpath to
classpath com.google.gms:google-services:4.0.1'

> 3. Sync Project with Gradle Files



UPDATE #1 2018/05/29

I got around the error by downgrading my firebase dependencies to ~12.0.0 in the app-level gradle. But this will severly impact the app, still looking around for more feasible workarounds.



apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
...
compile 'com.google.firebase:firebase-core:12.0.0'
compile 'com.google.firebase:firebase-database:12.0.0'
compile 'com.google.firebase:firebase-storage:12.0.0'
compile 'com.google.firebase:firebase-auth:12.0.0'
compile 'com.google.firebase:firebase-crash:12.0.0'
...








Same here, I have experienced the same issue described by @SimbaClaws. Everything was compiling smoothly until I faced the same issue yesterday.

I have the following codes in my project-level build.gradle,



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

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        //classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.google.gms:google-services:3.2.1'
        classpath 'io.fabric.tools:gradle:1.25.1'
    }
}

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

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





And the following codes for the app-level build.gradle



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

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "my.secret.application"
        minSdkVersion 16 // 19
        targetSdkVersion 26
        versionCode 1
        versionName "5.0.204"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.google.firebase:firebase-core:15.0.2'
    compile 'com.google.firebase:firebase-database:15.0.0'
    compile 'com.google.firebase:firebase-storage:15.0.2'
    compile 'com.google.firebase:firebase-auth:15.1.0'
    compile 'com.google.firebase:firebase-crash:15.0.2'
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support:recyclerview-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'com.android.support:palette-v7:26.+'
    compile 'com.android.support:support-v4:26.+'
    compile 'com.android.support:cardview-v7:26.+'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'org.greenrobot:eventbus:3.1.1'
    testCompile 'junit:junit:4.12'
    compile 'com.crashlytics.sdk.android:crashlytics:2.9.1'
}


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





Can anyone advise if I missed anything? I'm also still looking around for possible workarounds and answers. TIA!

Solution 4 - Gradle

Had same issue, for me none of the answers mentioned here worked. So I just updated dependencies in the gradle file and whichever dependency had com.google.gms: (kept them at same version example 16.0.0)

Solution 5 - Gradle

I have also experienced this issue. The root cause, I found out was that there inconsistent build Gradle version. In the Gradle Scripts repository "if I can call it that " there are two build gradle modules. The build.gradle (Project: name of app) and the build.gradle (Module: app). Make sure that classpath 'com.android.tools.build:gradle:3.2.1' in dependencies is using the latest and same version of the tool. Inconsistencies result in issues with the build.

Solution 6 - Gradle

In my case just added www earlier url was like url "https://jitpack.io/" after this added www started working for me. In other repositories also try to add explicit URLs.

maven {
            url "https://www.jitpack.io/"
        }

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSimbaClawsView Question on Stackoverflow
Solution 1 - GradleFioView Answer on Stackoverflow
Solution 2 - Gradleuser846316View Answer on Stackoverflow
Solution 3 - Gradleraiser00View Answer on Stackoverflow
Solution 4 - GradleSwapnil KadamView Answer on Stackoverflow
Solution 5 - GradleGeorgeView Answer on Stackoverflow
Solution 6 - GradleaNiKeTView Answer on Stackoverflow