Use the basic configuration of google maps in the Android Simulator

Source: Internet
Author: User
Tags certificate fingerprint


I flipped through the network for one morning and encountered a problem in configuring google maps in the android simulator. I checked a bunch of documents, but most of them were not very clear, after many experiments, I finally got it okay. Now I will detail each step and provide it to beginners like me. Common progress

1) first, you need to determine the JDK installation location, Windows-> Preferences-> Java-> Installed JREs. You can see that it is the location of Jre, in dos cmd mode, check whether the path of your current system is included. If it is not included in the current environment parameter. Because the keytool command we want to use is in this directory.
2) Find the location of debug. keystore of AVD, windows> perferences> android> build,
The default debug keystore text box lists C: \ Documents ents and Settings \ XXXXuser \. android \ debug. keystore, which is the default debug. keystore. You can change the file name first. We need to create a new debug. keystore
3) create a new debug. keystore and go to the C: \ Documents and Settings \ XXXXuser \. android directory under cmd.
Run the following command:
Keytool-genkey-v-keystore debug. key store-alias androiddebugkey-keyalg RSA-validity 10000
Enter the password, confirm the user information, and generate a debug. keystore.
4) Well, next we need to get MD5 and apply for an apikey from google, which is very simple.
Run the following command in the current directory:
Keytool-list-alias androiddebugkey-keystore debug. keystore
Enter the password you set in step 3 as prompted. OK, the following information will be displayed,
Certificate fingerprint (MD5): FC: ED: DE: BS: 16: 1A: E8: 05: F0: 44: AD: 4E: 45: 42: 4B: D4
This is the FC: ED: DE: BS: 16: 1A: E8: 05: F0: 44: AD: 4E: 45: 42: 4B: D4 we need to apply for apikey.
Access through a browser
In the My certificate's MD5 fingerprint text box, enter the MD5 code YOU JUST OBTAINED
Click Generate API Key,
Thank you for signing up for an Android Maps API key!
Your key is:
This is apikey. Remember to save it.

5) Create an android Project
Modify main. xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = ""
Android: orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
<View class = "com. google. android. maps. MapView"
Android: id = "@ + id/my_map"
Android: enabled = "true"
Android: apiKey = "0yrkog8325bnsbeuyxzmsj-cmg2rxxx?boa11a"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Apikey must be added when mapview is defined in layout, for example, android: apiKey = "0yrkog8325bnsbeuyxzmsj-cmg2rxxx?boa11a"
6) Modify androidmanifest. xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<Manifest xmlns: android = ""
Package = "com. testmap"
Android: versionCode = "1"
Android: versionName = "1.0" type = "codeph" text = "/codeph">
<Application android: icon = "@ drawable/icon" android: label = "@ string/app_name">
<Uses-library android: name = "com. google. android. maps"/>
<Activity android: name = ". testmap"
Android: label = "@ string/app_name">
<Action android: name = "android. intent. action. MAIN"/>
<Category android: name = "android. intent. category. LAUNCHER"/>

<Uses-sdk android: minSdkVersion = "5"/>
<Uses-permission android: name = "android. permission. INTERNET"> </uses-permission>
<Uses-permission android: name = "android. permission. ACCESS_COARSE_LOCATION"> </uses-permission>
<Uses-permission android: name = "android. permission. ACCESS_FINE_LOCATION"> </uses-permission>

We need to add the user library Reference <uses-library android: name = "com. google. android. maps"/>
Of course, you need to add the permission definition.
<Uses-permission android: name = "android. permission. INTERNET"> </uses-permission>
These two steps are essential

7) The last part is the main class.

Import com. google. android. maps. GeoPoint;
Import com. google. android. maps. MapActivity;
Import com. google. android. maps. MapController;
Import com. google. android. maps. MapView;
Import android. OS. Bundle;

Public class testmap extends MapActivity {
/** Called when the activity is first created .*/
@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. main );

// Get map view
MapView mv = (MapView) findViewById (R. id. my_map );
MapController controller = (MapController) mv. getController ();

GeoPoint p = new GeoPoint (int) (24.7*1000000), (int) (-238.8*1000000 ));
Controller. animateTo (p );
Controller. setZoom (9 );

@ Override
Protected boolean isRouteDisplayed (){
// TODO Auto-generated method stub
Return false;




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.