Home » Android » Android Studio Google-play-services library

Android Studio Google-play-services library

Posted by: admin May 14, 2020 Leave a comment

Questions:

I need the google-play-services library and I am using Android Studio.

  • I installed the google-play-service library with the SDK manager
  • Added the dependencies to my build.gradle

But when I sync my project it says:

could not found com.google.android.gms:play-services:3.1.36

I thinks the 3.1.36 version is an old one and I dunno the right version.

What should I do ?

How to&Answers:

In order to use that artifact, you need to install the “Google Repository” in the extras of the SDK manager, not “Google Play Services” as it sounds like you’ve done.

Answer:

is this how you are adding the dependency???

            buildscript {
            repositories {
                mavenCentral()
            }
            dependencies {
                classpath 'com.android.tools.build:gradle:0.5.+'
            }
        }


        dependencies {
            compile 'com.android.support:support-v4:13.0.0'
            compile 'com.google.android.gms:play-services:3.1.36'
        }


        android {
            compileSdkVersion 18
            buildToolsVersion '18.0.0'

            sourceSets {
                main {
                    manifest.srcFile 'AndroidManifest.xml'
                    java.srcDirs = ['src']
                    res.srcDirs = ['res']
                }
            }

}

Answer:

Go to File -> Project Structure -> Select Project Settings -> Select ‘Dependencies’ Tab Click ‘+’ -> 1.Library Dependencies -> Select com.google.android.gms:play-services:+

This will add the latest version of Google Play Services