【发布时间】:2015-05-06 06:42:32
【问题描述】:
使用 Android Studio 我正在尝试使用 GPS,但在调用时:
GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
结果是SERVICE_VERSION_UPDATE_REQUIRED。
经过一番谷歌搜索后,我发现安装在我的模拟器上的 Google Play 服务很旧。确切的版本是“versionName=6.7.74 (1723905-430)”
根据一些帖子,我需要下载并安装最新的。我尝试使用 adb 来执行此操作,结果如下:
adb install -r com.google.android.gms-v7.3.27.apk
987 KB/s (35812914 bytes in 35.420s)
pkg: /data/local/tmp/com.google.android.gms-v7.3.27.apk
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]
卸载 GPS 也不起作用。
然后我尝试修补 build.gradle:
compile 'com.google.android.gms:play-services:6.7.74'
但编译时收到错误:
Could not find com.google.android.gms:play-services:6.7.74.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services/6.7.74/play-services-6.7.74.pom
https://jcenter.bintray.com/com/google/android/gms/play-services/6.7.74/play-services-6.7.74.jar
我的模拟器是 5.1 版,我使用的是 Google API 22。
谢谢
编辑:
我想我找到了解决方法!在 build.gradle 我必须使用这个依赖。
compile 'com.google.android.gms:play-services:6.5.87'
不知道新版本有什么新功能,希望旧版本能满足我的需求。
【问题讨论】:
标签: android android-emulator gps