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条回答
混吃等死
2楼-- · 2019-01-04 01:31

I did following steps to recover from this:

1) Import google play services as project into your android sdk. In my system it is found at C:\adt-bundle-windows-x86_64-20140702\sdk\extras\google\google_play_services\libproject\google-play-services_lib

2) Your android application-> properties -> android

In the window

2.1) Click on Google APIs in project build target 2.2) Add google-play services in bottom frame and click on OK

Hope it gives clear instruction on what to do !!

Thanks.

查看更多
Evening l夕情丶
3楼-- · 2019-01-04 01:32

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.

查看更多
相关推荐>>
4楼-- · 2019-01-04 01:33

From here

You should be referencing a copy of the library that you copied to your development workspace—you should not reference the library directly from the Android SDK directory.

I faced this error because I referenced the original copy from SDK directory. Make sure that you first copy the library to android workspace and only reference it. In eclipse you can do it by checking "Copy projects into workspace" while importing the project.

查看更多
疯言疯语
5楼-- · 2019-01-04 01:34

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.
查看更多
冷血范
6楼-- · 2019-01-04 01:34

Replace version code with appropriate code of library version will solve your issue, like this:

 <integer name="google_play_services_version"> <versioncode> </integer>
查看更多
萌系小妹纸
7楼-- · 2019-01-04 01:34

Can directly used as

android:value="6587000"

in place of

android:value="@integer/google_play_services_version"

Cheers.

查看更多
登录 后发表回答