【问题标题】:eclipse import google-play-services_lib display error in valueseclipse import google-play-services_lib 在值中显示错误
【发布时间】:2014-05-23 05:54:48
【问题描述】:

将 google-play-services_lib 导入我的工作区,但在所有值文件夹中出现错误 我有干净的项目更改 Google API,添加 google-play-services.jar 文件,重新启动 eclipse 但仍然错误

在控制台显示如下错误

[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\ads_attrs.xml:10: error: Attribute "adSize" has already been defined
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\ads_attrs.xml:17: error: Attribute "adSizes" has already been defined
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\ads_attrs.xml:20: error: Attribute "adUnitId" has already been defined
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:4: error: Resource entry common_signin_btn_dark_text_default is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:4: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:5: error: Resource entry common_signin_btn_dark_text_pressed is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:5: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:6: error: Resource entry common_signin_btn_dark_text_disabled is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:6: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:7: error: Resource entry common_signin_btn_dark_text_focused is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:7: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:8: error: Resource entry common_signin_btn_light_text_default is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:8: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:9: error: Resource entry common_signin_btn_light_text_pressed is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:9: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:10: error: Resource entry common_signin_btn_light_text_disabled is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:10: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:11: error: Resource entry common_signin_btn_light_text_focused is already defined.
    [2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:11: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:12: error: Resource entry common_signin_btn_default_background is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:12: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_colors.xml:13: error: Resource entry common_action_bar_splitter is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\colors.xml:13: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\strings.xml:6: error: Resource entry common_google_play_services_install_title is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_strings.xml:21: Originally defined here.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\strings.xml:10: error: Resource entry common_google_play_services_install_text_phone is already defined.
[2014-05-23 11:54:22 - GPSService] D:\AndroidTool\workspace\google-play-services_lib\res\values\common_strings.xml:25: Originally defined here.

【问题讨论】:

  • 你给过目标版本吗?
  • 在库中不是目标版本,但根据您的建议,我已经提出但显示错误
  • 你检查过应用程序中的属性吗??
  • 请发布您的控制台消息或错误消息
  • @MRX 是的,最近谷歌服务更新并导入该库工作正常,没有问题

标签: android google-play-services android-support-library


【解决方案1】:

尝试导入库而不添加到工作区。就我而言,这是一个解决方案。

【讨论】:

    【解决方案2】:

    我遇到了 colors.xml 的相同问题,因为该文件似乎不再存在。 它之前包含的颜色现在在 common_colors.xml 中声明。 也许您想从项目中删除以前的 Google Play Services 文件夹以重新创建副本。

    【讨论】:

      【解决方案3】:

      尝试从项目所在的同一文件夹导入库而不添加到工作区。

      【讨论】:

        【解决方案4】:

        当我尝试更新我的 google play 服务版本时,我突然出现了这个错误。对我有用的完整过程是删除原始项目,从工作区中的其他项目中删除对播放服务项目的所有引用(即打开项目属性并将播放服务作为引用的 Android 库项目删除),然后导入玩服务项目。我不记得我是Import Existing Projects into Workspace 还是Import Existing Android Code

        摆脱“最初定义在这里”错误的技巧是首先删除对项目的现有旧引用。

        【讨论】:

          【解决方案5】:

          我遇到了同样的问题,这是由 extras\google\google_play_services\libproject\google-play-services_lib 文件夹中的一些冲突资源值引起的。

          由于 admob 和分析现已合并到 Google Play 服务中,我所做的就是从 SDK 管理器以及 Google Play 服务中卸载这些项目。然后我刚刚重新安装了 Google Play 服务。最终删除了重复的资源值,之后我的构建成功了。

          【讨论】:

          • 您是如何卸载这些项目的?如果我想要最新的带有 admob 和 analitics 的 google play 服务呢?
          • 我通过 SDK 管理器卸载了它们。在附加类别中取消选中它们。 Admob 已被播放服务弃用,因此您可以安全地卸载它,而且我相信 Google Analytics(分析)也已合并到 GPS 中,因此您可能也不需要它。
          【解决方案6】:

          您需要复制整个$SDK\sdk\extras\google\google_play_services 文件夹,包括source.properties 文件

          【讨论】:

          • 感谢您的回复,但新更新的 google play 服务工作正常,没有问题。
          【解决方案7】:

          删除旧项目,然后添加新项目,否则有些文件没有被删除,可能会导致这样的问题

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2016-05-21
            • 1970-01-01
            • 2015-08-29
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多