No Gradle-未找到与给定名称匹配的资源(在"value"处与值"@ integer/google_play_services_version")

No Gradle-未找到与给定名称匹配的资源(在

问题描述:

我使用的是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.

未找到与给定名称(在值"处与值"@ 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文件(例如,app/build.gradle)中的dependencies闭包中:

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 Services 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.

您可以在文档中了解有关此过程的更多信息. >.

You can read more about this process in the documentation.

更新

显然,该项目以某种方式直接使用了IntelliJ 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.