I\'m trying to add google play services to my libGDX project in IntelliJ Idea. I\'ve followed the setup guide here: https://developers.google.com/android/guides/setup
<Check you gradle settings, it may be set to Offline Work
At the latest Google Play Services 15.0.0, it occurs this error when you include entire play service like this
implementation 'com.google.android.gms:play‐services:15.0.0'
Instead, you must specific the detail service like Google Drive
com.google.android.gms:play-services-drive:15.0.0
I tried solving this problem for hours after I haven't used Android Studio some time and wasn't aware of the updates.
It is important that google() is the first item that stands in repositories like this:
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
Somehow google() was the second item after jcenter(), so everything was messed up and didn't work. Maybe this helps someone.
I had the issue when I put jcenter() before google() in project level build.gradle. When I changed the order and put google() before jcenter() in build.gradle the problem disappeared
Here is my final build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add this to your project-level build.gradle file:
repositories {
maven {
url "https://maven.google.com"
}
}
It worked for me
I hade the same problem and it resolved by disabling cradle offline mode although I could not remember when I did disable it!
heres the solution:
How to disable gradle 'offline mode' in android studio? [duplicate]