Gradle build tool cannot find play-services-tasks.aar? Why?
After doing the following changes the error disappeared:
- Removed
maven { url 'https://maven.google.com' }
from repositories in app build.gradle. - Added
maven { url 'https://maven.google.com' }
as first entry in allprojects/repositories in top level build.gradle - Changed all play-services and firebase dependencies to the latest versions
- 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
Draw Overlay in Android (System Wide)
Webview, Add Local .CSS File to an HTML Page
Generate Bitmap from HTML in Android
What Is the Fastest Way to Scrape HTML Webpage in Android
Reading Text File from Server on Android
Asynctask and Looper.Prepare() Error
Comparing Two Drawables in Android
What Does It Mean "No Launcher Activity Found!"
Android - Set Text to Textview
What Does This Google Play APK Publish Error Message Mean
Is There a Real Solution to Debug Cordova Apps
Edittext, Clear Focus on Touch Outside
Connectivitymanager.Connectivity_Action Deprecated
Noclassdeffounderror When Googleanalyticstracker.Getinstance()
How to Show an Activity Before My App Is Uninstalled (Android)
Distance Calculation from My Location to Destination Location in Android