[英]No Gradle - No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')
I'm using Android Studio IDE and i keep getting this error after adding the google play services library. 我正在使用Android Studio IDE,并且在添加Google Play服务库后我一直收到此错误。 Keep in mind this is using a project that is Eclipse based and we don't have any gradle files. 请记住,这是使用基于Eclipse的项目,我们没有任何gradle文件。
No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version') 找不到与给定名称匹配的资源('value'的值为'@ integer / google_play_services_version')
First let me say how I added the library… 首先让我说一下我是如何添加库的......
I located my android SDK folder, then find the google-play-services-jar and then i just copied it to my /libs folder. 我找到我的android SDK文件夹,然后找到google-play-services-jar然后我把它复制到我的/ libs文件夹。 Then I went under... 然后我去了......
File > Project Structure > Libraries > + added the google-play-services.jar
文件>项目结构>库> +添加了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. 当我进入文件>项目结构>模块> +模块依赖时,它只是说没有。
The Play Services SDK is an Android library project, not a JAR, which is why the version resource is not available to you. Play Services SDK是一个Android库项目,而不是JAR,这就是您无法使用版本资源的原因。 Undo all the stuff you did above, then add the following line to the dependencies
closure in your module's build.gradle
file (eg, app/build.gradle
): 撤消上面所做的所有内容,然后build.gradle
添加到模块的build.gradle
文件中的dependencies
闭包中(例如, app/build.gradle
):
compile 'com.google.android.gms:play-services:7.0.0'
Or, for a faster build and smaller APK, choose more focused dependencies , for whatever bit(s) of the Play Services SDK that you need. 或者,对于更快的构建和更小的APK,选择更有针对性的依赖关系 ,无论您需要什么位的Play服务SDK。
You can read more about this process in the documentation . 您可以在文档中阅读有关此过程的更多信息。
UPDATE UPDATE
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 . 显然,不知何故,这个项目直接使用IntelliJ IDEA构建系统,这意味着您必须遵循其他建议才能将Play Services SDK引入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. 话虽这么说,我真的建议转移到Gradle,因为我不会指望能够直接在Android Studio中直接使用IDEA构建系统。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.