如何找到Android谷歌播放服务版本

时间:2022-06-08 06:59:38

I'm working on an android project which requires the use of google maps. I've been reading tutorials, and I have to add this to the AndroidManifest.xml file:

我正在做一个需要使用谷歌地图的android项目。我一直在阅读教程,我必须把它添加到AndroidManifest中。xml文件:

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

The thing is, I don't know what number to substitute the "@integer/google_play_services_version" with.

问题是,我不知道用哪个数字来替换“@integer/google_play_services_version”。

If anyone knows what I should enter there, and how to obtain that integer value, I'd appreciate it.

如果有人知道我应该输入什么,以及如何获得那个整数值,我会很感激。

6 个解决方案

#1


50  

There is no need to subsitute. The value @integer/google_play_services_version takes care of it. Just make sure you have the latest Google Play Services library which is updated.

没有必要进行颠覆。值@integer/google_play_services_version负责此操作。请确保您拥有最新的谷歌游戏服务库。

You can find it under google-play-services_lib>res>values>version.xml if you wish to add the number rather than @integer/google_play_services_version.

您可以在google-play-services_lib>或>值>版本下找到它。如果希望添加数字而不是@integer/google_play_services_version,则添加xml。

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="google_play_services_version">4030500</integer>
</resources>

#2


14  

Here is the official guide for setting up Google Play Services in your project.

这里是在您的项目中设置谷歌Play服务的官方指南。

FYI, you could find the version number in this folder:

供您参考,您可以在这个文件夹中找到版本号:

~\android-studio\sdk\extras\google\m2repository\com\google\android\gms\play-services

Enjoy.

享受。

#3


7  

Error you have mentioned is maybe because of not adding Google play services lib as library of your project do the following.

您提到的错误可能是因为没有添加谷歌play services lib作为项目的库来执行以下操作。

  1. Select File -> Import -> Android -> Existing Android Code Into Workspace and click Next.
  2. 选择文件->导入-> Android ->现有的Android代码到工作区,然后点击Next。
  3. Select Browse, enter /extras/google/google_play_services/libproject/google-play-services_lib, and click Open. 3.Select Copy projects into workspace and click Finish.
  4. 选择Browse,输入/extras/谷歌/google_play_services/libproject/google-play-services_lib,然后单击Open。选择复制项目到工作区中,然后单击Finish。

Mark Google Play services as a library: Right-click the google-play-services_lib project, and choose Properties > Android. Tick the Is Library option.

Mark谷歌作为库播放服务:右键单击Google - Play -services_lib项目,并选择Properties > Android。勾选Is库选项。

Right click on your project -> go to properties -> click android -> click add button -> click google_play_services_lib -> ok -> apply -> ok clean your project this will remove your error

右键点击你的项目->转到属性->点击android ->点击添加按钮->点击google_play_services_lib -> ok -> apply ->清除你的项目这将消除你的错误

#4


6  

If you are using gradle just make sure you have the updated google play services version (downloaded using SDK manager) and put this in your project module dependency section:

如果您正在使用gradle,请确保您有更新的谷歌play服务版本(使用SDK管理器下载),并将其放在项目模块依赖部分:

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

IMPORTANT NOTE:
In general it is not a good practice to remove the concrete version of the source you are compiling against.

注意:一般来说,删除要编译的源的具体版本并不是一个好的实践。

#5


1  

I was in a case where I had to use the Froyo version of the Google Play Services, and that version doesn't require the tag. In fact, the XML entry google_play_services_version does not exist in the Froyo+ version of the Google Play Services library

我曾经遇到过这样的情况:我必须使用谷歌播放服务的Froyo版本,而那个版本不需要标签。事实上,XML entry google_play_services_version并不存在于谷歌游戏服务库的Froyo+版本中。

#6


0  

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

可能是因为您的库没有正确地链接到项目,或者您有较老的google-play-services库版本,所以会出现冲突,而Eclipse会变得很笨。:年代

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.

不,你不需要在integers.xml中添加任何东西。当您正确地将Google-play-services库链接到项目引用android:value=“@integer/google_play_services_version”时,将会找到,您已经准备好了。当您将库添加到项目中时,只需再做一件非常干净、非常有趣的Eclipse环境清理工作。

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

如果您在下次播放版本时硬编码这个数字,您将需要更新它。如果你忘记了这一点,你将再次花时间寻找bug。:年代

Hope it helped. ;)

希望它帮助。,)

#1


50  

There is no need to subsitute. The value @integer/google_play_services_version takes care of it. Just make sure you have the latest Google Play Services library which is updated.

没有必要进行颠覆。值@integer/google_play_services_version负责此操作。请确保您拥有最新的谷歌游戏服务库。

You can find it under google-play-services_lib>res>values>version.xml if you wish to add the number rather than @integer/google_play_services_version.

您可以在google-play-services_lib>或>值>版本下找到它。如果希望添加数字而不是@integer/google_play_services_version,则添加xml。

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="google_play_services_version">4030500</integer>
</resources>

#2


14  

Here is the official guide for setting up Google Play Services in your project.

这里是在您的项目中设置谷歌Play服务的官方指南。

FYI, you could find the version number in this folder:

供您参考,您可以在这个文件夹中找到版本号:

~\android-studio\sdk\extras\google\m2repository\com\google\android\gms\play-services

Enjoy.

享受。

#3


7  

Error you have mentioned is maybe because of not adding Google play services lib as library of your project do the following.

您提到的错误可能是因为没有添加谷歌play services lib作为项目的库来执行以下操作。

  1. Select File -> Import -> Android -> Existing Android Code Into Workspace and click Next.
  2. 选择文件->导入-> Android ->现有的Android代码到工作区,然后点击Next。
  3. Select Browse, enter /extras/google/google_play_services/libproject/google-play-services_lib, and click Open. 3.Select Copy projects into workspace and click Finish.
  4. 选择Browse,输入/extras/谷歌/google_play_services/libproject/google-play-services_lib,然后单击Open。选择复制项目到工作区中,然后单击Finish。

Mark Google Play services as a library: Right-click the google-play-services_lib project, and choose Properties > Android. Tick the Is Library option.

Mark谷歌作为库播放服务:右键单击Google - Play -services_lib项目,并选择Properties > Android。勾选Is库选项。

Right click on your project -> go to properties -> click android -> click add button -> click google_play_services_lib -> ok -> apply -> ok clean your project this will remove your error

右键点击你的项目->转到属性->点击android ->点击添加按钮->点击google_play_services_lib -> ok -> apply ->清除你的项目这将消除你的错误

#4


6  

If you are using gradle just make sure you have the updated google play services version (downloaded using SDK manager) and put this in your project module dependency section:

如果您正在使用gradle,请确保您有更新的谷歌play服务版本(使用SDK管理器下载),并将其放在项目模块依赖部分:

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

IMPORTANT NOTE:
In general it is not a good practice to remove the concrete version of the source you are compiling against.

注意:一般来说,删除要编译的源的具体版本并不是一个好的实践。

#5


1  

I was in a case where I had to use the Froyo version of the Google Play Services, and that version doesn't require the tag. In fact, the XML entry google_play_services_version does not exist in the Froyo+ version of the Google Play Services library

我曾经遇到过这样的情况:我必须使用谷歌播放服务的Froyo版本,而那个版本不需要标签。事实上,XML entry google_play_services_version并不存在于谷歌游戏服务库的Froyo+版本中。

#6


0  

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

可能是因为您的库没有正确地链接到项目,或者您有较老的google-play-services库版本,所以会出现冲突,而Eclipse会变得很笨。:年代

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.

不,你不需要在integers.xml中添加任何东西。当您正确地将Google-play-services库链接到项目引用android:value=“@integer/google_play_services_version”时,将会找到,您已经准备好了。当您将库添加到项目中时,只需再做一件非常干净、非常有趣的Eclipse环境清理工作。

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

如果您在下次播放版本时硬编码这个数字,您将需要更新它。如果你忘记了这一点,你将再次花时间寻找bug。:年代

Hope it helped. ;)

希望它帮助。,)