android - 如何将 Google Play 服务添加到我的 Eclipse ADT 项目

标签 android eclipse google-play-services eclipse-adt

这是我要修复的错误:

描述:错误:错误:找不到与给定名称匹配的资源(在“值”处,值为“@integer/google_play_services_version”)。 资源:AndroidManifest.xml 位置:第75行 类型:Android AAPT 问题

enter image description here

我正在尝试实现我在 https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project 看到的解决方案,在“将 Google Play 服务添加到您的项目”下的“其他”选项卡中。我已经通过在我的 app/build.grandle 文件的 dependencies {} 部分中使用以下行在 Android Studio 中修复了这个错误:

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

但是,由于特殊情况,这次我需要在 Eclipse ADT 中实现相同的修复。使用 Eclipse Android SDK 管理器,我已经安装了 Google Play 服务,修订版 39:

enter image description here

我可以确认它已安装在我计算机上的 C:\Users\jaimemontoya\android-sdks\extras\google\google_play_services:

enter image description here

https://developers.google.com/android/guides/setup#add_google_play_services_to_your_project 的说明中,它说:“将位于/extras/google/google_play_services/libproject/google-play-services_lib/的库项目复制到您维护 Android 应用程序项目的位置。”

如您在上图中所见,我的 Google Play 服务版本 39 安装中没有/extras/google/google_play_services/libproject/google-play-services_lib/文件夹。有什么想法吗?

最佳答案

我实现了 Andrew S 在 Missing "<sdk>/extras/google/google_play_services/libproject" folder after update to revision 30 提供的解决方案.首先,我下载了https://dl-ssl.google.com/android/repository/google_play_services_8298000_r28.zip .这意味着我没有尝试使用 Google Play 服务版本 39,而是使用了较旧的版本 28。

我提取文件并将其放在 C:\Users\jaimemontoya\android-sdks\extras\google\google-play-services:

enter image description here

在 Eclipse 中,我使用了 File > Import... > Android > Existing Android Code Into Workspace > Root Directory: C:\Users\jaimemontoya\android-sdks\extras\google\google-play-services\libproject\google-播放服务库

我确认一切看起来都是正确的:

要导入的项目:C:\Users\jaimemontoya\android-sdks\extras\google\google-play-services\libproject\google-play-services_lib 新项目名称:google-play-services_lib

然后,在 Eclipse Package Explorer 中,我右键单击我的项目,转到“属性”,然后单击“Android”,最后在向下滚动后,我使用“添加...”按钮添加了 google-play-services_lib 库。它将作为添加的库之一出现:

enter image description here

现在错误已为我修复:

enter image description here

关于android - 如何将 Google Play 服务添加到我的 Eclipse ADT 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42979484/

相关文章:

android - 使用GIGYA登录,无需任何社交服务提供商

android - 按下后退按钮时的动画

java - 如何创建行之间具有不同背景的警报对话框列表

java - Eclipse J 面向导 : How to create next page dynamically?

eclipse - eclipse 中自动发布

android - com.google.android.gms.common.api.internal.zza的依赖项解析错误

android - Google billing 消耗品和非消耗品

java - 从字符串中提取整数

java - Maven 无法访问(现有)pom 文件

java - Google Play 游戏成就 onClose 回调