google map api v2 和旧版本的 google play services lib [英] google map api v2, and older version of google play services lib

查看:21
本文介绍了google map api v2 和旧版本的 google play services lib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将在我的 android 应用程序中使用地图,我应该使用 google play 服务.我在这里读了很多 qa,例如 这个.在提到的问题中,接受的答案建议使用旧版本的 google play services lib,比如 Froyo 的那个.我下载了 google play services r10 并在我的应用程序中使用它,但出现错误.

I am going to use maps in my android application and I should use google play services. I read lots of qa here like this. In the mentioned question, the accepted answers suggets using older version of google play services lib, like the one for Froyo. I downloaded google play services r10 and used it in my app, but I got errors.

如果我从清单中排除这行代码:

If I exclude this line of code from manifest:

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

并在我的设备中运行该应用程序(我设备中的 google playe 服务的当前版本是 3.2.66 ),它会引发错误:

and run the app in my device (current version of google playe services in my device is 3.2.66 ), it throws error:

java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4030500 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

如果我将它包含在 android:value=4030500 中,应用程序会运行,但说我应该更新我的google play services".

and if I include it with android:value=4030500 the app runs but says that I should update my "google play services".

那么我应该放什么 android:value 或者我的方式是否正确?

So what should I put android:value or Is my way correct at all ?

问候

推荐答案

我下载了 google play services r10 并在我的应用程序中使用了它

I downloaded google play services r10 and used it in my app

以上陈述是您问题的根本原因.如果你真的用过 r10(甚至 r12),比去掉之后

The above statement is the root cause of your problems. If you really used r10 (or even r12), than after removing

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

从您的 AndroidManifest 中,您不会收到此错误:

from your AndroidManifest, you would not get this error:

java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4030500 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

这个错误只是说,您链接到 4.0.30 版本的 Google Play 服务库.

This error simply says, you are linked to 4.0.30 version of the Google Play services library.

所以解决方案是删除上面的 meta-data 并确保链接到以前的版本之一.

So the solution is to remove the above meta-data and making sure you link to one of the previous versions.

如果使用 gradle 或 maven,只需将依赖版本设置为 3.2.65.如果使用旧方式开发,请在 Android SDK Manager 中下载 Froyo 的 Google Play 服务,将其从 sdk/extras/google/ 复制到您的工作目录,然后在您的项目首选项中选择此项目作为库依赖项目.

If using gradle or maven, just set your dependency version to 3.2.65. If developing the old way, download Google Play services for Froyo in Android SDK Manager, copy that from sdk/extras/google/ into your working directory and in your project preferences choose this project as a library dependency project.

这篇关于google map api v2 和旧版本的 google play services lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆