1.网址 code.google.com/android/maps-api-signup.html
2.输入自己的MD5 指纹可以获取API Key.
3.MD5指纹的获取方法如下:
C:\Documents and Settings\gm\.android>keytool -list -alias androiddebugkey -keys
tore debug.keystore
输入keystore密码:
androiddebugkey, 2012-5-10, PrivateKeyEntry,
认证指纹 (MD5): 6D:04:82:A5:64:B1:35:BA:F6:D8:1A:11:DB:40:A7:10
4.然后在main.xml文件中
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0UFYSeMNW5Tl718hzHQMstjDoqYNyM9UjetImsw"
/>
</LinearLayout>
5. 主文件内容为
package org.marsdroid.map01;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MainActivity extends MapActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}