1. 首先开发Google Map的应用 需要Google APIs。 在项目中就必须导入Google map api。但是不能手动添加map的jar包到project。
默认情况下是android的某个版本 例如android2.2 ,就必须改成对应版本的Google API。
2. 在用模拟器run的时候,同时要注意模拟器的Target必须是对应的Google APIs(Google Inc.)。
3. 在AndroidManifest.xml中,必须添加<users-library android:name="com.google.android.maps"/>
4. 每个开发android map的project都必须申请一个APIKey。
这里查了一下,有两种方法。第一种是找到debug.keystore,获取其MD5之后,在
http://code.google.com/intl/zh-CN/android/maps-api-signup.html 在google的android map API Key申请页面中输入md5 获得APIKey。
第二种方法是最近推出的,个人觉得比较简单 步骤不是那么的多,同时,还可以随时更换你的key。
登录:https://code.google.com/apis/console
PS:在布局xml里的android:apiKey K必须要是大写
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/frame" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.google.android.maps.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="0G-myfY-Tr_VnWaKYW8VAW-R8ijZBz4er9GGKpQ" android:clickable="true" /> </LinearLayout>