Android Studio Google-play-services library

蓝咒 提交于 2019-12-18 21:16:31

问题


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 ?


回答1:


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.




回答2:


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']
                }
            }

}




回答3:


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



来源:https://stackoverflow.com/questions/18382166/android-studio-google-play-services-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!