简体   繁体   English

我收到“错误:找不到与给定名称匹配的资源(值为@integer/google_play_services_version)”

[英]I'm getting "Error: No resource found that matches the given name (at value with value @integer/google_play_services_version)"

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.我真的不知道发生了什么,我尝试将值设置为固定值(我知道这不是最好的解决方案),但问题仍然存在。

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. 对于使用Android Studio和/或Gradle遇到此问题的任何人,您只需确保在成绩文件中具有正确的依赖关系。 Again, do NOT hardcode this value into a versions.xml file.. 同样,不要将此值硬编码到versions.xml文件中。

Gradle eg. Gradle例如。

dependencies {
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services-gcm:7.5.0'
}

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. 单击文件>导入,选择Android>现有Android代码到工作区,然后浏览工作区导入库项目。

Right click on your android project. 右键单击你的android项目。 Goto properties. 转到属性。 Choose Android on the left panel. 在左侧面板中选择Android。 Click on Add and browse the library project. 单击“添加”并浏览库项目。 Select the same. 选择相同。 Click ok and apply. 单击确定并应用。

在此输入图像描述

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

Install and configure the Google Play services SDK properly. 正确安装和配置Google Play服务SDK。 You don't need to hard code that value. 您不需要对该值进行硬编码。

  • 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. 我发现必须将播放服务libproject导入到与项目相同的物理驱动器上。 (check the 'Copy projects into workspace' checkbox when you import) (导入时选中'将项目复制到工作区'复选框)

I solved the problem by copying the version.xml file from google play service lib. 我通过从google play服务lib复制version.xml文件解决了这个问题。

google-play-services_lib/res/values/version.xml 

to my project 到我的项目

MyApp/res/values/version.xml

You need to add the play services library to your project. 您需要将play服务库添加到项目中。 This doesn't work by jus adding an external jar. 这不适用于添加外部jar。 You need to import the play_services_lib project into your workspace. 您需要将play_services_lib项目导入工作区。 And then add this library to you project by going to 然后通过转到此项目将此库添加到您的项目中

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. 在此之后,错误将消失,您无需添加任何固定值。

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遇到此问题的任何人,您只需确保在成绩档案中具有正确的依赖关系。

  1. You need to setup Google Play Services – https://developers.google.com/android/guides/setup (1. Debes configurar Google Play Services) 您需要设置Google Play服务 - https://developers.google.com/android/guides/setup(1。Debes configurar Google Play服务)

  2. 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:) 如果你已经完成了上一步那么(si ya completaste ese paso entonces)...假设你有这个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' } 依赖项{compile fileTree(dir:'libs',include:['* .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服务库)

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' } 依赖{compile fileTree(dir:'libs',include:['* .jar'])编译'com.android.support:appcompat-v7:21.0.3'compile'c​​om.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文件中是一种不好的做法(se Considera una mala practica“quemar”o dejar fijo este valor en el archivo mencionado)

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'). 
]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Android Eclipse中出现错误“找不到与给定名称匹配的资源(在'value'值'@integer/google_play_services_version')” - Getting error "No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')" in Android Eclipse 如何修复“找不到与给定名称匹配的资源('value'与值'@ integer / google_play_services_version')” - How to fix “No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version')” No Gradle - 找不到与给定名称匹配的资源('value'的值为'@ integer / google_play_services_version') - No Gradle - No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version') 找不到与给定名称匹配的资源(在“值”处与值“ @ integer / google_play_services_version”) - No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version') 未找到与给定名称匹配的资源(值与值 @integer/google_play_services_version)”- Visual Studio 2015 更新 3 - No resource found that matches the given name (at value with value @integer/google_play_services_version)” - Visual Studio 2015 Update 3 如何修复Xamarin android c#中的“找不到与给定名称(在'value'处与值'@ integer / google_play_services_version匹配)的资源” - How to fix“No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version)” in Xamarin android c# 错误:找不到资源整数/ google_play_services_version(又名app:integer / google_play_services_version) - error: resource integer/google_play_services_version (aka app:integer/google_play_services_version) not found Android:找不到Admob资源@ integer / google_play_services_version - Android: Admob resource not found @integer/google_play_services_version 来自aar库的google_play_services_version值出错 - Error with google_play_services_version value from aar library 找不到Android清单@ integer / google_play_services_version - Android manifest @integer/google_play_services_version not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM