Adding Google Play services version to your app's manifest?

190,292

Solution 1

It is probably that your library is not linked to project properly or that you have older google-play-services library version so conflict appears and Eclipse got stupid.. :S

No you don't need to add anything in integers.xml. When you link properly Google-play-services library to your project reference android:value="@integer/google_play_services_version" will be found and you are ready to go. When you add library to your project just do one more clean so funny Eclipse environment sweep-out things properly.

If you hardcode somewhere this number when next play version come you would need to update it. And if you forget that, you will spend time again looking for bug.. :S

Hope it helped. ;)

Solution 2

I got the solution.

  • Step 1: Right click on your project at Package explorer(left side in eclipse)
  • Step 2: goto Android.
  • Step 3: In Library section Add Library...(google-play-services_lib)
    see below buttes

    • Copy the library project at

    <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/

    • to the location where you maintain your Android app projects. If you are using Eclipse, import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
    • Click Here For more.
  • Step 4: Click Apply
  • Step 5: Click ok
  • Step 6: Refresh you app from package Explorer.
  • Step 7: you will see error is gone.

Solution 3

In Android Studio you can fix this by simply adding this to your Gradle file:

compile 'com.google.android.gms:play-services:6.5.87'

EDIT

Now, due to updates and new Gradle API the line you should use is:

implementation 'com.google.android.gms:play-services:12.0.0'

One more important tip: Avoid using bundled version of Google Play Services, but consider declaring just dependencies that your app needs to reduce it size as well as to reduce unnecessary hit to 65k methods limit. Something like (i.e. for Maps) this would be better than general play-services usage above:

implementation 'com.google.android.gms:play-services-maps:12.0.0'

Solution 4

Just add the library reference, go to Propertes -> Android, then add the library.

enter image description here

then add into you AndroidManifest.xml

   <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

Solution 5

I had the same problem in Android Studio 1.2.1.1. It was just liske the other answers said, however, I was not able to find where to add the dependencies. Finally I found it under File->Project structure->Dependencies This menu will give you the option at add the dependency to the Google Play Services library.

Share:
190,292
Adz
Author by

Adz

Updated on March 21, 2020

Comments

  • Adz
    Adz about 4 years

    I'm following this tutorial: https://developers.google.com/maps/documentation/android/start#overview on how to add Google Maps to an app within the Android SDK.

    The only problem I seem to be having is during this bit (I've done everything else with no errors):

    Edit your application's AndroidManifest.xml file, and add the following declaration within the
    
     <application> element. This embeds the version of Google Play services that the app was compiled with.
    
     <meta-data
     android:name="com.google.android.gms.version"
     android:value="@integer/google_play_services_version" />
    
    The error is:
       No resources found that match the given name (at 'value' with value '@integer/    
       google_play_services_version').
    

    I've tried to follow this persons solution to the same problem: Google Play Services Library update and missing symbol @integer/google_play_services_version

    but I'm still getting the same error. Any help please?

  • Ragaisis
    Ragaisis over 10 years
    yep, on android studio I've added google play service as a module (not as a library), but I've forgot to add this module to my project module where the manifest file is. This solved the problem :)
  • Goffredo
    Goffredo over 10 years
    Thanks, this fixed my issue. For an idiot-proof step-by-step guide for referencing a library project in Eclipse / ADT, please see the Google Tools docs. I'm apparently an idiot, because I was trying to add the library under "Java Build Path : Libraries" - no worky.
  • Adz
    Adz over 10 years
    Sorry for the late reply, but yes, this was the problem, the library wasn't linked properly to my project!
  • panchicore
    panchicore over 10 years
    never do that, its not dynamicly.
  • Michael Scheper
    Michael Scheper about 10 years
    This is exactly the wrong thing to do. See Ewoks' answer, at stackoverflow.com/a/20068489/1450294
  • Dzmitry Lazerka
    Dzmitry Lazerka about 10 years
    How to do that for Ant?
  • user3241507
    user3241507 about 10 years
    after adding via project, I get that the entire app cannot execute
  • Bianca Daniciuc
    Bianca Daniciuc over 9 years
    I had the same error, the copy of the google-play-services lib in my workspace was old (so not containing the integer resource), and replacing the lib with an updated version did the trick.
  • Anthony De Souza
    Anthony De Souza over 9 years
    Thanks Jeffro and Ewoks. I thought I had linked my library correctly but I noticed a red X icon by it. It was still referring to my SDK path instead of the local workspace version I had created! Removing and adding the correct one worked. #IAmAnIdiot
  • natur3
    natur3 over 9 years
    If it helps, I had to take a few more steps in Android Studio. Went to: Project Structure --> App --> Dependencies --> click + for add option for Library --> play-services (x.x.x). I got an error when I rebuilt and the library added was play-services...0.0. I was missing the Google Play Repositories from the SDK Manager under the Extras. When I came back and repeated those steps the Library now had an actual version number and rebuilt successfully.
  • Simon
    Simon over 9 years
    Thanks - this helped. I'm trying to do this tutorial and had encountered this error and your solution helped me:github.com/googledrive/android-demos
  • AdamMc331
    AdamMc331 about 9 years
    @natur3 thanks for adding those extra steps, fixed it for me too!
  • Anne Gunn
    Anne Gunn almost 9 years
    +1 for the help on the obscure navigation in AS 1.2. Thank you! It didn't help, in my case, that I was working on a project handed off from another dev and had never actually installed the right version of the play services library using SDK manager :$. Once I downloaded/installed the library, then I went back and removed/added again and the compile error went away.
  • Anne Gunn
    Anne Gunn almost 9 years
    See the accepted answer above (stackoverflow.com/a/20068489/165164) for why this is a bad idea.
  • Someone Somewhere
    Someone Somewhere over 8 years
    I just needed to clean the project, after the gradle sync, and the missing integer error went away. This works well too: compile 'com.google.android.gms:play-services-appindexing:7.8.0'
  • Ewoks
    Ewoks about 6 years
    I know it is an old Q/A but people are still stumbling upon it, so it made sense to update it to new AS3 & Gradle APIs and to emphasise urge to use specific library instead of whole bundle. I hope original author doesn't mind