我正在尝试使用 Google map 。所以我得到了 Android API key :
我还打开了 Google map API V2:
在我的 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
您似乎也没有为 V2 的 list 文件设置正确的元数据。
您可能只想查看 map V1 和 V2 之间发生的所有更改,因为它需要对代码进行一些返工,而不仅仅是简单的插入。
关于java - 尝试在 Android 上使用 Google map 时出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20523300/