android-studio - 如何在 Android Studio 中查找 google play 服务版本?

标签 android-studio google-play-services build.gradle

我正在尝试将 google play 服务用于定位目的。因此我想将 google play 服务添加到我的应用程序中。在 build.gradle dependincies 中,我添加了以下行。

    compile 'com.google.android.gms:play-services:9.0.1'

但是它给出了以下错误

 Error:(25, 13) Failed to resolve: com.google.android.gms:play-services:9.0.1

我找不到安装了哪个版本的 Google Play 服务。在 SDK 工具选项卡中,它显示版本 30。

我也尝试过以下行,但它也给出了同样的错误

 compile 'com.google.android.gms:play-services:30'

编辑:这是整个 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'
}

最佳答案

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

关于android-studio - 如何在 Android Studio 中查找 google play 服务版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37545147/

相关文章:

gradle - 如何简化Gradle命令行?

android - 如何添加多个 Jars 以从 Gradle Build 中排除

android - 如何在 Android Studio 中的 "docs"中找到 "android/sdk"?

android - 如何将 iPhone 添加到 Android Studio?

java - lib 项目在哪里用于 google play 服务?

java - android google play libs使用过多的CPU使用率

gradle - 在build.gradle.kts中传递jmeter简单配置时出错

java - onActivityCreated/onStart/onViewCreated 方法中的 getView() 出现 NullPointerException 警告

Android Gradle 构建 : duplicate entry: META-INF/app_release. kotlin_module

android - 从 Play 服务中删除了帐户选择器?