如何在Android Studio中找到Google Play服务版本?

use*_*302 1 google-play-services android-studio build.gradle

我正在尝试使用Google Play服务进行定位.因此,我想将谷歌播放服务添加到我的应用程序.在build.gradle依赖项中,我添加了以下行.

    compile 'com.google.android.gms:play-services:9.0.1'
Run Code Online (Sandbox Code Playgroud)

但是它会出现以下错误

 Error:(25, 13) Failed to resolve: com.google.android.gms:play-services:9.0.1
Run Code Online (Sandbox Code Playgroud)

我无法找到安装了哪个版本的Google Play服务.在SDK工具选项卡中,它表示版本30.

我也尝试过跟随线,但它也给出了同样的错误

 compile 'com.google.android.gms:play-services:30'
Run Code Online (Sandbox Code Playgroud)

编辑:这是整个build.gradle文件.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "ozu.cs394.umurali.whereismycar"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services:9.0.1'
}
Run Code Online (Sandbox Code Playgroud)

pm *_*bey 18

  • 转到文件 - >项目结构
  • 选择"项目设置"
  • 选择"依赖关系"选项卡
  • 点击"+"并选择"1.Library Dependencies"
  • 搜索 : com.google.android.gms:play-services
  • 选择最新版本并单击"确定"

  • 最好的答案 (2认同)