我正在尝试将 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/