46

I'm developing an app on Ionic Framework/cordova, and when I try "cordova run android" I get this:

"Error: No resource found that matches the given name (at value with value @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.

starball
  • 20,030
  • 7
  • 43
  • 238
Juan Manuel Masud
  • 684
  • 1
  • 7
  • 15
  • https://developers.google.com/maps/documentation/android/start#install_and_configure_the_google_play_services_sdk – CommonsWare May 29 '14 at 00:30

6 Answers6

23

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

Gradle eg.

dependencies {
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services-gcm:7.5.0'
}
Jeremy
  • 3,438
  • 3
  • 34
  • 57
  • Building on this answer, you can get Cordova to add this Gradle dependency for you during the build by adding a framework element to your plugin.xml file: . I'm using Cordova version 5.1.1 and cordova-android version 4.0.2. – crispydc Aug 19 '15 at 18:27
11

Install and configure the Google Play services SDK properly. You don't need to hard code that value.

  • Add Google Play services as an Android library project.

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)

android_Muncher
  • 1,057
  • 7
  • 14
  • how do you do that if you are using Unity3d ? – CthulhuJon Dec 17 '14 at 00:37
  • After you have downloaded the SDK, you can add it as project from here: [AndroidSdk_Home]/extras/google/google_play_services/libproject/google-play-services_lib .. thanks to: http://stackoverflow.com/a/17611095/2162226 – Gene Bo Feb 19 '15 at 22:10
  • adding the play services libproject to the same physical drive worked for me. – kev Mar 25 '15 at 13:34
10

I solved the problem by copying the version.xml file from google play service lib.

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

to my project

MyApp/res/values/version.xml
MH2K9
  • 11,951
  • 7
  • 32
  • 49
  • 2
    Helped me too... Thanks ! – Rajendra Khabiya Jul 08 '15 at 07:06
  • 1
    this answer is a little bit wrong because when google update it's support library they will update the value of @integer/google_play_services_version and you will have problems in you application. It can be fixed with this answer very easy but fix is temporally – Stoycho Andreev Sep 10 '15 at 09:28
6

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

Your Project -> Properties -> Android -> Library

Checkout this link for detailed explanation on how to import the play_services_lib into your workspace

http://developer.android.com/google/play-services/setup.html

After this the error will vanish and you need not add any fixed value.

Arvind Ram
  • 172
  • 1
  • 3
4

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.

  1. You need to setup Google Play Services – https://developers.google.com/android/guides/setup (1. Debes configurar Google Play Services)

  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:)

    dependencies { compile fileTree(dir: ‘libs’, include: [‘*.jar’]) compile ‘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)

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’ }

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)

Mauricio Gracia Gutierrez
  • 10,288
  • 6
  • 68
  • 99
1

For anyone having this issue while building in Unity3D:

1.Assets/PlayServicesResolver/AndroidResolver/ResolveClientJars

2.Build again

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'). 
]
Manfred Radlwimmer
  • 13,257
  • 13
  • 53
  • 62
koStitch
  • 21
  • 3