【问题标题】:How to find google play service version in Android Studio?如何在 Android Studio 中查找 google play 服务版本?
【发布时间】:2016-09-29 10:24:18
【问题描述】:

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

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

【问题讨论】:

  • 你有哪个版本的SDK工具?
  • 我有 SDK 工具 25.1.6
  • 你能把你的build.gradle(app)文件发一下吗
  • 好的,我贴出来了。
  • 您是否尝试过清理您的项目?构建 -> 清理项目?

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


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

【讨论】:

  • 最佳答案
  • 感谢您的回答,我现在可以在不接触 gradle 文件的情况下添加已安装的库,谢谢
【解决方案2】:

在 Extras 下检查您的 SDK 管理器,并确保已安装 Google Repository

【讨论】:

    【解决方案3】:

    您应该更新sdk manager 中的 google play services 存储库:

    【讨论】:

    • 在某些情况下需要知道确切的版本号。就像使用 react-native-geo-location-service [github.com/Agontuk/react-native-geolocation-service] 在这种情况下,sdk 经理向我展示了 version49 这是不正确的,我建议按照 pm dubey 的答案来获得你需要的东西。
    猜你喜欢
    • 2013-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多