5

I have Android project and when run ./gradlew dependencies command, I get the following error and I cannot figure out how to use Google Play Service 8.4.0. (8.3.0 works)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.google.android.gms:play-services:8.4.0.
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.pom
         https://jcenter.bintray.com/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.jar
         https://maven.fabric.io/public/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.pom
         https://maven.fabric.io/public/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.jar
         https://zendesk.artifactoryonline.com/zendesk/repo/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.pom
         https://zendesk.artifactoryonline.com/zendesk/repo/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.jar
         https://repo1.maven.org/maven2/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.pom
         https://repo1.maven.org/maven2/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.jar
         file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.pom
         file:/usr/local/android-sdk-linux/extras/android/m2repository/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.jar
         file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.pom
         file:/usr/local/android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services/8.4.0/play-services-8.4.0.jar

Here is how the app gradle file looks like.

  dependencies {
      ....
      compile 'com.google.android.gms:play-services:8.4.0'
      ....
  }

I have've tried to put the following in a project gradle file but didn't work help.

    dependencies {
      classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
      classpath 'com.google.gms:google-services:2.0.0-alpha3'
    }

Could anyone help me to debug further?

kimh
  • 719
  • 2
  • 9
  • 15

5 Answers5

8

A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugCompile'. Could not find com.google.android.gms:play-services:8.4.0.

Post your total build.gradle

  1. Use Latest versions of build tools
  2. Then call classpath 'com.android.tools.build:gradle:2.0.0-alpha3'

Finally

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId ""
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

Check Version conflict updating to 8.4.0

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
  • 1
    Sorry, this was my customer's project, so I was hesitant to put the whole gradle file. – kimh Feb 01 '16 at 08:05
  • 1
    This answer works for me. Besides the answer, I noticed that installing `build-tools-23.02` was failing. After installing 23.02 and modify the grale files, then the dependencies was successfully installed. – kimh Feb 01 '16 at 08:07
5

Looks like Google subsumed many libraries under Google Repository. Install Google Repository and the Android Support Repository via the SDK Manager and gradle should be able to resolve the libraries. Here my gradle.build file for comparison:

buildscript {
    repositories { jcenter() }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
}
apply plugin: 'com.android.application'
android {
  repositories { jcenter() }
  compileSdkVersion 24
  buildToolsVersion '24.0.1'
  dependencies {
    compile 'com.google.android.gms:play-services:9.2.1'
  }
}
Motine
  • 1,638
  • 18
  • 18
2

I have the same problem also. It would be the missing of following packages in the Android SDK:

  • Android Support Repository
  • Google Play services
  • Google Repository

If you are using the Android SDK command line tools sdkmanager, you can run following command to install the related packages:

sdkmanager "extras;android;m2repository"
sdkmanager "extras;google;m2repository"
sdkmanager "extras;google;google_play_services"
Raymond Chiu
  • 934
  • 9
  • 15
1

you need

buildToolsVersion "23.0.2"

you have download that in sdk manager

and change that in build.gradle

and i use this in build.gradle project side

classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0-beta2'
mehrdad khosravi
  • 2,228
  • 9
  • 29
  • 34
0

also add this line to your app level gradle

apply plugin: 'com.google.gms.google-services'
dependencies {
      ....
      compile 'com.google.android.gms:play-services:8.4.0'
      ....
  }
Anjali Tripathi
  • 1,477
  • 9
  • 28