Gradle could not find dependency com.google.android.gms:play-services
26,542
Solution 1
i fixed the issue by adding google() repository in build.gradle project module
Solution 2
I had the same issue, i fix it by adding google()
repository in build.gradle
project module
![Xavier P](https://lh5.googleusercontent.com/-zru5XpowwEw/AAAAAAAAAAI/AAAAAAAAAE0/_klqoLMQYI0/photo.jpg?sz=256)
Author by
Xavier P
Updated on August 01, 2020Comments
-
Xavier P almost 4 years
I have a problem since I upgraded my Android Studio to 3.0.0 : I cannot find
com.google.android.gms:play-services
anymore!After adding this dependency, when I try to sync my project I get this message :
Failed to resolve: com.google.android.gms:play-services-games:11.4.2
I can click on "Install repository and sync project" but when I do, I get this message :
Could not find dependency "com.google.android.gms:play-services-games:11.4.2"
I tried to search, but the only solutions I found was to install Google repository, and add
jcenter()
to the repositories in mybuild.gradle
file But I already did that!Any idea?
Here is my build.gradle file :
buildscript { repositories { mavenLocal() mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1' } } allprojects { apply plugin: "eclipse" apply plugin: "idea" version = '1.0' ext { appName = "Glowee" gdxVersion = '1.9.7' roboVMVersion = '2.3.1' box2DLightsVersion = '1.4' ashleyVersion = '1.7.0' aiVersion = '1.8.0' } repositories { mavenLocal() mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "https://oss.sonatype.org/content/repositories/releases/" } } } project(":desktop") { apply plugin: "java" dependencies { compile project(":core") compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" } } project(":android") { apply plugin: "android" configurations { natives } dependencies { compile project(":core") compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64" compile "com.google.android.gms:play-services-games:11.4.2" compile "com.google.android.gms:play-services-ads:11.4.2" compile "com.google.android.gms:play-services-plus:11.4.2" } } project(":ios") { apply plugin: "java" apply plugin: "robovm" dependencies { compile project(":core") compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion" compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion" compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios" } } project(":core") { apply plugin: "java" dependencies { compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" } } tasks.eclipse.doLast { delete ".project" }
-
Saranjith over 6 yearsWhile this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
-
other Tall guy over 6 yearsI attached the screenshot of my Project Build Gradle . That's all . And he needs to do is just add "google()" this in the repositories { } and that is what the screenshot tells(or how I implemented) It is a link to the imgur that's all @Saranjith
-
salmanseifian about 6 yearsI have this problem, and I have
google()
in my repositories. -
Borja almost 5 years@SalmanSeifian put google() in the first line, before jcenter()