10

I am trying to get location and update to server in my Android app. This is my Gradle code, here I included compile 'com.google.android.gms:play-services:11.2.0'. This line is from the documentation:

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

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:25.3.1'       
}

But this is the error I get:

Error:(23, 13) Failed to resolve: com.google.android.gms:play-services:11.2.0
Install Repository and sync project
Show in File
Show in Project Structure dialog

Clicking in "Install Repository and sync project" doesn't work.

Mahidul Islam
  • 580
  • 11
  • 29
  • Possible duplicate of [Failed to resolve: com.google.firebase:firebase-core:11.2.0](https://stackoverflow.com/questions/45696551/failed-to-resolve-com-google-firebasefirebase-core11-2-0) – Darush Aug 26 '17 at 19:25

3 Answers3

29

Add this to your project-level build.gradle file:

repositories {
    maven {
        url "https://maven.google.com"
    }
}
Saurabh Thorat
  • 18,131
  • 5
  • 53
  • 70
  • 4
    As per [Google Play services release notes](https://developers.google.com/android/guides/releases), dependencies are now available from `maven.google.com` – Saurabh Thorat Aug 15 '17 at 08:14
0

Try update version new of google play service

  1. Start Android Studio.
  2. On the Tools menu, click Android > SDK Manager.
  3. Update the Android Studio SDK Manager: click SDK Tools, expand Support
  4. Repository, select Google Repository, and then click OK.
Pang
  • 9,564
  • 146
  • 81
  • 122
Nguyễn Trung Hiếu
  • 2,004
  • 1
  • 10
  • 22
0

In build.gradle file:

repositories {
    maven {
        url "https://maven.google.com"
    }
}

Same problem and more solution here

Error:(39, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.0

Mahidul Islam
  • 580
  • 11
  • 29