This quick guide will show you exactly what code you need to put in your Android project. You will also need a Google Maps API Key, later. Tip: Your “Project Build Target” must include Google APIs in order to show the map. To find your current build target in Eclipse, right-click on your project’s name->Properties->Android.

There will be three files to edit. A xml file, java file, and the manifest.

First, in your project’s manifest (AndroidManifest.xml) add the following lines of code that are bolded and the red code must be changed to values specific for your project:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
 android:versionName="1.0" >
<uses-sdk android:minSdkVersion="4" />
<!-- Google Maps needs access to the Internet -->
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" >
<!-- Google Maps is in an external library that needs to be imported -->
     <uses-library android:name="" />

     <activity android:name=".MainActivity" android:label="@string/app_name">
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER" />
<!-- Add this activity if you aren't showing the Google Map on your first Activity -->      <!-- android:theme="..NoTitleBar" will give the map more space by removing the title bar -->
     <activity android:name=".HelloGoogleMaps" android:theme="@android:style/Theme.NoTitleBar" />


Second, in your file (create it if you don’t have it), have it look something like the following:


public class HelloGoogleMaps extends MapActivity {
    public void onCreate(Bundle savedInstanceState) {
MapView mapView = (MapView) findViewById(;
 /*Is required for every MapActivity*/
    protected boolean isRouteDisplayed(){
        return false;


Third, add the following code to your layout file (ex: map.xml) where you want the map to appear:

<?xml version="1.0" encoding="utf-8"?>
<!-- android:clickable allows user-interaction with the map, like panning and zooming --> <!-- The android:apiKey value will look something like 19pTmji6NUULWO2OGr5HGYNX3JEKGAqvZWqbQtx -->
    android:apiKey="Your Maps API Key goes here"

Now, all you have to get is get your Android Maps API Key and replace it in the above code and you will have Google Maps in your application.


If there are any questions, don’t be afraid to ask.

How to Display Google Maps in Android