【问题标题】:Cannot resolve symbol 'LocationClient' in Android Studio无法在 Android Studio 中解析符号“LocationClient”
【发布时间】:2015-05-14 11:38:50
【问题描述】:

我在 Android Studio 中开发一个我想在其中使用位置服务的应用程序时遇到此错误。
我知道这个问题之前已经被问过,但我相信之前的问题是在 Eclipse 中开发的一个应用程序。

我相信这可能是 Google Play 服务设置的问题
我已按照此处的说明进行操作 http://developer.android.com/google/play-services/setup.html,但我现在遇到了错误。

这可能与我之前通过 Eclipse 中的 SDK 管理器安装 Google Play 服务这一事实有关吗?

任何帮助将不胜感激,谢谢

【问题讨论】:

    标签: android android-studio google-play-services location-client location-services


    【解决方案1】:

    LocationClient 几个月前已从 Play 服务 SDK 中删除。现在,您可以使用 GoogleApiClientLocationServices.APIFusedLocationProviderApi 访问 Play Services 中的融合位置提供程序。 This sample project 演示了如何从这个新 API 中获取位置修复,this blog post 也介绍了它的使用。

    【讨论】:

      【解决方案2】:

      小技巧

      在您的build.gradle 中添加google play services 旧版本

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

      我知道这不是好的解决方案。但它可以解决你的问题。

      【讨论】:

        【解决方案3】:

        或者,如果您只需要定位服务,请使用

        compile 'com.google.android.gms:play-services-location:x.x.x'
        

        Here您可以找到一个包含一些 Google Play 服务 API 的列表(滚动到表 1)

        P.S.: 还不能添加 cmets :(

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2018-05-03
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2019-02-07
          • 2023-03-27
          • 2015-07-28
          相关资源
          最近更新 更多