Android 我收到“错误:未找到与给定名称匹配的资源(值与值 @integer/google_play_services_version)”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23923933/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I'm getting "Error: No resource found that matches the given name (at value with value @integer/google_play_services_version)"
提问by Juan Manuel Masud
I'm developing an app on Ionic Framework/cordova, and when I try "cordova run android" I get this:
我正在 Ionic Framework/cordova 上开发一个应用程序,当我尝试“cordova run android”时,我得到了这个:
"Error: No resource found that matches the given name (at value with value @integer/google_play_services_version)"
“错误:未找到与给定名称匹配的资源(在值为 @integer/google_play_services_version 的值)”
I don't really know what is happening, I tried to set the value with a fixed value (I know is not the best solution), and the problem continues.
我真的不知道发生了什么,我尝试将值设置为固定值(我知道这不是最佳解决方案),但问题仍然存在。
Thanks in advance!
提前致谢!
采纳答案by Navneeth
Copy the google-play services_lib library project to your workspace OR Import the library project to your eclipse.
将 google-play services_lib 库项目复制到您的工作区或将库项目导入您的 eclipse。
Click File > Import, select Android > Existing Android Code into Workspace,and browse the workspace import the library project.
点击File > Import,选择Android > Existing Android Code into Workspace,浏览workspace导入库项目。
Right click on your android project. Goto properties. Choose Android on the left panel. Click on Add and browse the library project. Select the same. Click ok and apply.
右键单击您的 android 项目。转到属性。在左侧面板上选择 Android。单击添加并浏览库项目。选择相同。单击确定并应用。
checkout this link for reference. http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
结帐此链接以供参考。http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
回答by Jeremy
For anyone encountering this issue using Android Studio and/or Gradle, you just need to make sure that you have the right dependency in your grade file. Again, do NOT hardcode this value into a versions.xml file..
对于使用 Android Studio 和/或 Gradle 遇到此问题的任何人,您只需要确保您的成绩文件中有正确的依赖项。同样,不要将此值硬编码到 versions.xml 文件中。
Gradle eg.
摇篮例如。
dependencies {
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
}
回答by android_Muncher
Install and configure the Google Play services SDK properly. You don't need to hard code that value.
正确安装和配置 Google Play 服务 SDK。您不需要对该值进行硬编码。
- Add Google Play services as an Android library project.
- 添加 Google Play 服务作为 Android 库项目。
I have found that the play services libproject has to be imported onto the same physical drive as your project. (check the 'Copy projects into workspace' checkbox when you import)
我发现必须将播放服务 libproject 导入到与您的项目相同的物理驱动器上。(导入时选中“将项目复制到工作区”复选框)
回答by MH2K9
I solved the problem by copying the version.xml
file from google play service lib.
我通过version.xml
从 google play 服务库复制文件解决了这个问题。
google-play-services_lib/res/values/version.xml
to my project
到我的项目
MyApp/res/values/version.xml
回答by Arvind Ram
You need to add the play services library to your project. This doesn't work by jus adding an external jar. You need to import the play_services_lib project into your workspace. And then add this library to you project by going to
您需要将播放服务库添加到您的项目中。仅仅添加一个外部 jar 是行不通的。您需要将 play_services_lib 项目导入您的工作区。然后通过转到将此库添加到您的项目中
Your Project -> Properties -> Android -> Library
你的项目 -> 属性 -> Android -> 库
Checkout this link for detailed explanation on how to import the play_services_lib into your workspace
查看此链接以获取有关如何将 play_services_lib 导入工作区的详细说明
http://developer.android.com/google/play-services/setup.html
http://developer.android.com/google/play-services/setup.html
After this the error will vanish and you need not add any fixed value.
在此之后,错误将消失,您无需添加任何固定值。
回答by Mauricio Gracia Gutierrez
For anyone encountering this issue using Android Studio / Gradle, you just need to make sure that you have the right dependency in your grade file.
对于使用 Android Studio / Gradle 遇到此问题的任何人,您只需要确保您的成绩文件中有正确的依赖项。
You need to setup Google Play Services – https://developers.google.com/android/guides/setup(1. Debes configurar Google Play Services)
If you already completed previous step then (si ya completaste ese paso entonces)… Let say that you have this Gradle: (suponiendo que ya tienes un archivo Gradle asi:)
dependencies { compile fileTree(dir: ‘libs', include: [‘*.jar']) compile ‘com.google.android.gms:play-services-gcm:7.5.0' }
您需要设置 Google Play 服务 – https://developers.google.com/android/guides/setup(1. Debes configurar Google Play Services)
如果您已经完成了上一步,那么(si ya completaste ese paso entonces)……假设您拥有这个 Gradle:(suponiendo que ya tienes un archivo Gradle asi:)
依赖{编译文件树(目录:'libs',包括:['*.jar'])编译'com.google.android.gms:play-services-gcm:7.5.0'}
you need to add a single line for Gradle to include the Google Play Services library (solo necesitas agregar un solo renglon para que Gradle incluya la libreria de Google Play Services library)
您需要为 Gradle 添加一行以包含 Google Play 服务库(solo necesitas agregar un solo renglon para que Gradle incluya la libreria de Google Play Services library)
dependencies { compile fileTree(dir: ‘libs', include: [‘*.jar']) compile ‘com.android.support:appcompat-v7:21.0.3' compile ‘com.google.android.gms:play-services-gcm:7.5.0' }
依赖{编译文件树(目录:'libs',包括:['*.jar'])编译'com.android.support:appcompat-v7:21.0.3'编译'com.google.android.gms:play-services -gcm:7.5.0' }
Is a bad practice to hardcode this value into the versions.xml file (se considera una mala practica “quemar” o dejar fijo este valor en el archivo mencionado)
将此值硬编码到versions.xml 文件中是一种不好的做法(请参阅考虑a una mala practica “quemar” o dejar fijo este valor en el archivo mencionado)
回答by koStitch
For anyone having this issue while building in Unity3D:
对于在 Unity3D 中构建时遇到此问题的任何人:
1.Assets/PlayServicesResolver/AndroidResolver/ResolveClientJars
1.Assets/PlayServicesResolver/AndroidResolver/ResolveClientJars
2.Build again
2.重新构建
This fixed this exact issue for me today.
这为我今天解决了这个确切的问题。
stderr[
AndroidManifest.xml:19: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
]