Adding Google Play services version to your app

2019-01-04 01:12发布

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?

18条回答
倾城 Initia
2楼-- · 2019-01-04 01:48

I was getting the same error; I had previously installed the google-play-services_lib for Google Maps (and it was working fine) but then when I later tried adding the meta-data entry to my Manifest I was getting the error. I tried all the above suggestions but nothing would link them properly; I finally removed the link from my project (project-properties-Android, remove google-play-services_lib library), then removed from Eclipse workspace, deleted the files on the disk, and finally used the SDK manager to reinstall from scratch.

That seemed to finally do the trick; now Eclipse has decided to allow me to leave the meta-data entry with no errors.

查看更多
你好瞎i
3楼-- · 2019-01-04 01:49

Simply removing the google play services library from the project and adding once again from sdk->extras->google folder solved my problem perfectly.

查看更多
闹够了就滚
4楼-- · 2019-01-04 01:52

For my case, I just restart my Eclipse and it works.

I have been working for 2 weeks without shutting it down, I think it goes haywire.

Thanks for the suggestion though Ewoks!

查看更多
叼着烟拽天下
5楼-- · 2019-01-04 01:54

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

查看更多
我欲成王,谁敢阻挡
6楼-- · 2019-01-04 01:56

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" />
查看更多
可以哭但决不认输i
7楼-- · 2019-01-04 01:57

This error can also happen when you've downloaded a new version of Google Play Services and not installed the latest SDK. Thats what happened to me. So, as the others mentioned, if you try to import Google Play Services and then open the console, you'll see a compile error. Try installing all the recent Android SDKs and try again, if this is the case.

查看更多
登录 后发表回答