Gradle Build Tool Cannot Find Play-Services-Tasks.Aar? Why

Gradle build tool cannot find play-services-tasks.aar? Why?

After doing the following changes the error disappeared:

  1. Removed maven { url 'https://maven.google.com' } from repositories in app build.gradle.
  2. Added maven { url 'https://maven.google.com' } as first entry in allprojects/repositories in top level build.gradle
  3. Changed all play-services and firebase dependencies to the latest versions
  4. Changed version of google-services plugin to classpath 'com.google.gms:google-services:4.0.1'

Could not find play-services-basement.aar

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()
}
}

Could not find play-services-tasks-license.aar (com.google.android.gms:play-services-tasks-license:11.8.0)

JCenter doesn't serve https://jcenter.bintray.com/com/google/android/gms/play-services-tasks-license/11.8.0/play-services-tasks-license-11.8.0.aar. This does:

maven { https://maven.google.com/ } 

Swap jcenter() with maven { url "https://maven.google.com" } and try again.

build.gradle

allprojects {
repositories {
mavenLocal()
maven {
url "https://maven.google.com"
}
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.31.0'
force 'com.google.android.gms:play-services-base:11.8.0'
force 'com.google.android.gms:play-services-maps:11.8.0'
force 'com.google.android.gms:play-services-gcm:11.8.0'
force 'com.google.android.gms:play-services-location:11.8.0'
}
}
}
}

Android gradle Failed to resolve: play-services-basement

Add google() repository in your build.gradle. And check that google() is before jcenter().

Ionic3 Build-Error: Could not find play-services-auth-base.aar (15.0.1)

If your app does not require any of the newer Google APIs, try specifying an older Play Services Version in your config.xml file. I got a successful build by using 11.6.2. Anything newer gave me the same build error.

Failed to resolve: play-services-flags

Fixed by changing order of repos in PROJECT build.grade:

Instead of

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

put

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

I think someone suggested this but I don't see his answer anymore.

Very strange issue.

React native build started failing because Gradle cannot find Could not find play-services-basement

Adding google() before jcenter() in bulild.gradle as mentioned in below site fixed my issue.

https://www.developerfaqs.com/4120/android-gradle-failed-to-resolve-play-services-basement



Related Topics



Leave a reply



Submit