No Gradle - 找不到与给定名称匹配的资源(在“值"处,值为“@integer/google_play_services_version") [英] No Gradle - No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')

查看:25
本文介绍了No Gradle - 找不到与给定名称匹配的资源(在“值"处,值为“@integer/google_play_services_version")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Android Studio IDE,但在添加 google play 服务库后,我不断收到此错误.请记住,这是使用基于 Eclipse 的项目,我们没有任何 gradle 文件.

I'm using Android Studio IDE and i keep getting this error after adding the google play services library. Keep in mind this is using a project that is Eclipse based and we don't have any gradle files.

未找到与给定名称匹配的资源(在 'value' 处,值为 '@integer/google_play_services_version')

No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')

首先让我说我是如何添加图书馆的……

First let me say how I added the library…

我找到了我的 android SDK 文件夹,然后找到了 google-play-services-jar,然后我将它复制到了我的/libs 文件夹中.然后我就下...

I located my android SDK folder, then find the google-play-services-jar and then i just copied it to my /libs folder. Then I went under...

文件 > 项目结构 > 库 > + 添加了 google-play-services.jar

File > Project Structure > Libraries > + added the google-play-services.jar

现在它列在这个下面,但我在我的在线清单中不断收到上述错误......

Now its listed under this, but I keep getting the above error in my manifest on line…

<meta-data android:name="com.google.android.gms.version"
           android:value="@integer/google_play_services_version"/>

我试过上下搜索要做什么,但没有任何效果对我有用.此外,当我转到文件 > 项目结构 > 模块 > + 模块依赖项时,它只是说没有.

I've tried searching high and low on what to do, but nothing is working for me. Also when I go under File > Project Structure > Modules > + Module Dependency it just says there is none.

推荐答案

Play Services SDK 是一个 Android 库项目,而不是 JAR,这就是版本资源对您不可用的原因.撤消您在上面所做的所有操作,然后将以下行添加到您模块的 build.gradle 文件中的 dependencies 闭包(例如,app/build.gradle):

The Play Services SDK is an Android library project, not a JAR, which is why the version resource is not available to you. Undo all the stuff you did above, then add the following line to the dependencies closure in your module's build.gradle file (e.g., app/build.gradle):

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

或者,为了更快的构建和更小的 APK,选择 更专注依赖项,适用于您需要的 Play 服务 SDK 的任何部分.

Or, for a faster build and smaller APK, choose more focused dependencies, for whatever bit(s) of the Play Services SDK that you need.

您可以在文档.

更新

显然,不知何故,该项目直接使用 IntelliJ IDEA 构建系统,这意味着您必须遵循 将 Play 服务 SDK 导入 IDEA 的其他建议.话虽如此,我真的建议改用 Gradle,因为我并不指望长期直接在 Android Studio 中使用 IDEA 构建系统.

Apparently, somehow, this project is using the IntelliJ IDEA build system directly, which means that you will have to follow other advice for getting the Play Services SDK into IDEA. That being said, I would really recommend moving over to Gradle, as I would not count on necessarily being able to use the IDEA build system in Android Studio directly over the long haul.

这篇关于No Gradle - 找不到与给定名称匹配的资源(在“值"处,值为“@integer/google_play_services_version")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆