【发布时间】:2013-02-01 11:16:43
【问题描述】:
我已经下载了谷歌 API,现在我的地图 XML 似乎是一个标准问题,只是在应该显示谷歌地图的地方显示一个灰色的手柄,如图所示:
我尝试了两个 API 密钥(通过生成一个新密钥)无济于事。我在清单中添加了 Internet 权限和 Google 地图库,如下所示:
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.map"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainMap"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
API 密钥:
这是我的地图 XML 布局:
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="AIzaSyBV_Zio-pysGWfjGo7dUpGvYRZ9PB3NQLc"/>
</RelativeLayout>
我将我的项目设置为 Google API 的 SDK 版本,并且与我的 AVD 相同。
当我的应用程序加载并开始我的意图时,我在控制台中收到以下错误:
02-16 15:55:04.637: E/MapActivity(305): Couldn't get connection factory client
【问题讨论】:
-
XML 权限不应该在应用程序的 XML 中
-
您尝试做的这些方法在2012年12月被贬值:请阅读this document。而且即使您使用新的 Google Maps API v2,您也无法在模拟器中部署您的应用:请参阅this document
标签: java android api google-maps