2

我正在尝试使用 google play 服务创建一个位置感知的 android 应用程序,因为这似乎是新的推荐方式。我已经使用我在 android 开发者网站上找到的教程来设置我的项目。它似乎正确并且构建良好,但是,当该活动在具有 google play 服务依赖项的活动开始之前,我在 log cat 中看到以下内容。

06-18 01:31:04.126: I/dalvikvm(30480): Failed resolving Lcom/example/activities/NewActivity; interface 1045 'Lcom/google/android/gms/common/GooglePlayServicesClient$ConnectionCallbacks;'
06-18 01:31:04.126: W/dalvikvm(30480): Link of class 'Lcom/example/activities/NewActivity;' failed
06-18 01:31:04.126: W/dalvikvm(30480): Unable to resolve superclass of Lcom/example/activities/NewActivity_; (930)
06-18 01:31:04.126: W/dalvikvm(30480): Link of class 'Lcom/example/activities/NewActivity_;' failed
06-18 01:31:04.126: E/dalvikvm(30480): Could not find class 'com.example.activities.NewActivity_', referenced from method com.example.activities.HomeActivity.clickCurrentDonation
06-18 01:31:04.126: W/dalvikvm(30480): VFY: unable to resolve const-class 936 (Lcom/example/activities/NewActivity_;) in Lcom/example/activities/HomeActivity;

这里NewActivity是使用google play服务无法加载的Activity,HomeActivity是调用NewActivity的Activity。即使在我尝试启动 NewActivity 之前,这些错误也会出现在 HomeActivity 的负载上。

如果我不包含谷歌播放服务代码,我已经确认这可以正常工作。

我正在做的唯一似乎与规范或教程不同的事情是我正在使用 android-annotations 项目,这就是为什么您会在上面看到对 NewActivity_ 的引用,这是一个基于生成的类我在基类中编写的代码。

有没有其他人遇到过这个或知道如何解决?

谢谢你的帮助!

4

1 回答 1

2

只需从 SDK 管理器重新安装 Google Play 服务并尝试再次链接并清理构建项目。

如果仍然不起作用,请下载另一个 SDK 文件夹并安装 Google Play Services,然后在您的工作区中导入 Google Play Services 项目并链接到您当前的项目。

我不知道..它很奇怪,但它对我有用。

于 2014-08-23T18:47:50.713 回答