Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find play-services-basement.aar

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?

like image 762
SimbaClaws Avatar asked May 28 '18 09:05

SimbaClaws


3 Answers

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()
    }
  }
like image 116
Fio Avatar answered Oct 22 '22 17:10

Fio


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!

like image 6
raiser00 Avatar answered Oct 22 '22 18:10

raiser00


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.

<application>
    <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="[ADMOB_APP_ID]"/>
</application>
like image 14
user846316 Avatar answered Oct 22 '22 16:10

user846316