【问题标题】:Error using Google Play services使用 Google Play 服务时出错
【发布时间】:2016-09-21 23:49:32
【问题描述】:

我正在尝试使用 google play 服务位置 API。 我已经从 sdk manager 安装了 Google Repositories。

我正在使用 Eclipse 并导入我去过的位置 jar: path_to_sdk/extras/google/m2repository/com/google/android/gms/play-services-location/9.0.0

我已经解压了 aar 文件并将 classes.jar 文件添加到我项目的 libs 文件夹中。并且还包括作为项目的库。

添加代码后:

public class ListenerService extends Service {
     public void onCreate() {
         mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(LocationServices.API)
            .build();
    }
}

我在 eclipse 中得到这个错误:

The type com.google.android.gms.common.api.Api$zzf cannot be resolved. It is indirectly referenced from required .class files

我做错了什么?我错过了什么?

【问题讨论】:

  • 显示更多代码,以便我们获得更好的想法。当它应该使用上下文时,它可能在匿名类中时看起来你正在使用它
  • 我修改了代码示例。

标签: android eclipse google-play-services


【解决方案1】:

play-services-location 取决于其他 AAR:play-services-baseplay-services-basementplay-services-mapsplay-services-tasksfirebase-common(通过查看 9.0 的 POM 文件)。

您需要在您的应用中包含这些内容,以确保解决所有类。

【讨论】:

    猜你喜欢
    • 2016-03-14
    • 2016-03-11
    • 2014-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-12
    相关资源
    最近更新 更多