java - 尝试在 Android 上使用 Google map 时出现异常

标签 java android google-maps

我正在尝试使用 Google map 。所以我得到了 Android API key : enter image description here

我还打开了 Google map API V2:

enter image description here

在我的 AndroidManifest.xml 中我添加了:

 <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="AIzaSyAJR******************B2ur31EYL84"/> 

在布局中我添加 MapViews:

<com.google.android.gms.maps.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1.0"
    android:apiKey="AIzaSyAJR******************B2ur31EYL84"
    android:clickable="true"
    android:state_enabled="true" >
</com.google.android.gms.maps.MapView>

还有一个:

<com.google.android.gms.maps.MapView
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:apiKey="AIzaSyAJR******************B2ur31EYL84"
    android:clickable="true" />

AndroidManifest 开头为:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.bssys"
    android:versionCode="1"
    android:versionName="1.1.1" >

我的程序包几乎都是以com.bssys.android开头。/**类名或包**/ 当我的 Activity 开始时,我有一个异常(exception):

<小时/>

堆栈跟踪太大。所以我把它写在单独的文件中。 https://dl.dropboxusercontent.com/u/77318984/stackTrace.txt

我如何运行程序: 我在 Intellij Idea 上编写并在 Debug模式下运行。 使用 Android SDK 版本 4.4。 在 Google Nexus 7 (Android 4.4) 上运行

最佳答案

您使用了错误的 Google map V2 View 类

com.google.android.maps.MapView

是旧的 V1 类。

应该是

com.google.android.gms.maps.MapView

看: Google Maps V2 MapView

您似乎也没有为 V2 的 list 文件设置正确的元数据。

您可能只想查看 map V1 和 V2 之间发生的所有更改,因为它需要对代码进行一些返工,而不仅仅是简单的插入。

关于java - 尝试在 Android 上使用 Google map 时出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20523300/

相关文章:

java - 无法解析导入 javax.servlet 和 org.hibernate - Ubuntu 12.04 上的 Eclipse Kepler

Java:更喜欢取决于类实例或静态方法的实用程序类?

android - 执行 doInBackground() 时出错

java - 谷歌地方信息 API : place category and place information

java - 如何将包含反斜杠 (\) 的用户名传递给 jcifs smb?

java - java中如何接受null JTextField?

javascript - 网页是否有可能检测到它是从 webview 应用程序访问的?

java - Java 中文件中的数组数组

javascript - Google Place 自动完成邮政编码

javascript - 使用nodejs在谷歌地图上绘制几个标记