android - 无法使用最新的 google play 服务 7.5.0 的位置

标签 android google-play-services

我的问题是:

我在此处遵循新指令 https://developers.google.com/cloud-messaging/android/start实现我自己的 Android GCM 应用程序。

而且,我有一个处理位置跟踪的代码部分的问题,它以前确实有效,但现在所有相关的导入都“不存在”。例如:(错误:包 com.google.android.gms.location 不存在)

import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;

我做过的所有事情:

  • 将类路径“com.google.gms:google-services:1.3.0-beta1”添加到顶级构建文件。
  • 将 compile 'com.google.android.gms:play-services:7.5.+' 添加到我的应用程序 Gradle。

我尝试了什么

  • 尝试改用 com.google.android.gms:play-services:7.3.0,它适用于 Location,但我不确定 GCM 是否适用,因为我还没有完成它。

  • 尝试改用 com.google.android.gms:play-services:7.5.0。当最新的是 7.5.0 所以 7.5.+ 与 ~ 7.5.0 相同时,这似乎很愚蠢。但只是尝试并失败了。

那么,你以前面对过吗?以及如何解决?

最佳答案

如果您将类路径 'com.google.gms:google-services:1.3.0-beta1' 设置为顶级构建中的依赖项
应用插件apply plugin: 'com.google.gms.google-services'到app build root
添加了 compile "com.google.android.gms:play-services:7.5.+" 作为应用程序构建依赖项,同步后您会看到消息 error instal support reposotory 只需单击它并从向导安装存储库

关于android - 无法使用最新的 google play 服务 7.5.0 的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30591453/

相关文章:

android - 获取父 Activity 的名称-Null Exception

android - jsonschema2pojo gradle 插件不在子项目中生成 Java 类

Android 依赖项引用了不存在的库 google-play-services_lib.jar

java - android getLastKnownLocation() 返回总是返回 null

android - Android 中的 Google Play 服务库

java - XMLPullParser 特殊字符

java - 如何在不是 Activity 的布局上暂时隐藏操作栏

Android Realm 查询关系

android - G+ 登录入门结果为 "An internal error occurred"

android - 如何让 Play 游戏服务在启动时不自动登录?