Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle could not find dependency com.google.android.gms:play-services

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 my build.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"
}
like image 421
Xavier P Avatar asked Oct 26 '17 12:10

Xavier P


2 Answers

i fixed the issue by adding google() repository in build.gradle project module

enter image description here

like image 121
other Tall guy Avatar answered Nov 08 '22 22:11

other Tall guy


I had the same issue, i fix it by adding google() repository in build.gradle project module

like image 42
sabith.ak Avatar answered Nov 08 '22 22:11

sabith.ak