Note: Version 1 of the Google Maps Android API as been officially deprecated as of December 3rd, 2012. This means that from March 3rd, 2013 you will no longer be able to request an API key for this version. No new features will be added to Google Maps Android API v1. However, apps using v1 will continue to work on devices. Existing and new developers are encouraged to use Google Maps Android API v2.

Google Maps Android API v2

Creating a new Android application that uses the Google Maps Android API v2 requires several steps. Many of the steps outlined in this section will only have to be performed once, but some of the information will be a handy reference for future applications.

Steps to be followed

Step 1 :

Download and configure the Google Play services SDK. The Google Maps Android API is distributed as part of this SDK.
i.e. The Google Play services SDK is an extension to the Android SDK and is available to you as a downloadable package from the SDK Manager. The download includes the client library and code samples.

Note: Google Play services is not supported on the Android emulator — to develop using the APIs, you need to provide a development device such as an Android phone or tablet.
You can develop on any compatible Android device that runs Android 2.2 or higher and includes the Google Play Store.

To install the Google Play services SDK for development:
a) From Eclipse launch the SDK manager (Window > Android SDK Manager.)

b) Scroll to the bottom of the package list, select Extras > Google Play services, and install it.
– The Google Play services SDK is saved in your Android SDK environment at your-android-sdk-folder/extras/google/google_play_services/

c) Copy the google-play-services_lib library project from our-android-sdk-folder/extras/google/google_play_services/libproject/ into the source tree(i.e. Workspace) where you maintain your Android app projects.
If you are using Eclipse, import the library project into your workspace. Click File > Import , select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.

To set up a project to use the Google Play services SDK:
1. Reference the library project in your Android project.
i.e. right click on project> properties > android > add > From the list of available library projects, select a project and click OK > apply.

2. If you are using ProGuard, add the following lines in the project_directory/proguard-project.txt file to prevent ProGuard from stripping away required classes:

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();

Step 2:

Obtain an API key. To do this, you will need to register a project in the Google APIs Console, and get a signing certificate for your app.

Note: The Google Maps Android API v2 uses

a new system of managing keys. Existing keys from a Google Maps Android v1 application, commonly known as MapView, will not work with the v2 API.

To access the Google Maps servers with the Maps API, you have to add a Maps API key to your application. The key is free, you can use it with any of your applications that call the Maps API, and it supports an unlimited number of users. You obtain a Maps API key from the Google APIs Console by providing your application’s signing certificate and its package name. Once you have the key, you add it to your application by adding an element to your application’s manifest file AndroidManifest.xml.

Displaying the certificate fingerprint(SHA1):

On Windows through command prompt go to folder C:Program FilesJavajre7bin
Then use the following command to retrieve SHA1 fingerprint.

keytool.exe -list -v -alias androiddebugkey -keystore "C:Users[USER NAME].androiddebug.keystore" -storepass android -keypass android 

e.g. In my case the would be:

C:Program FilesJavajre7bin> keytool.exe -list -v -alias androiddebugkey -keystore "C:UsersVikas.androiddebug.keystore" -storepass android -keypass android

you should see the display that is similar to this:

Alias name: androiddebugkey
Creation date: Sep 12, 2012
Entry type: PrivateKeyEntry
Certificate chain length: 1
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 26be7f47
Valid from: Wed Sep 12 10:38:51 IST 2012 until: Fri Sep 05 10:38:51 IST 2042
Certificate fingerprints:
         MD5:  AB:48:9B:38:5E:64:6A:1A:A9:BF:24:BD:0B:11:C8:69
         SHA1: 59:3F:88:AD:01:66:CD:A9:54:A9:BA:1D:9A:BE:81:46:F4:2D:47:4E
         SHA256: B3:1D:A7:C4:45:2F:25:4B:80:BB:92:34:A6:D7:94:BE:F4:74:B8:35:87:
         Signature algorithm name: SHA256withRSA
         Version: 3


#1: ObjectId: Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: B5 18 AA 02 C6 C1 CD 85   03 3E 43 78 30 CE 04 52  .........>Cx0..R
0010: 55 5D FC F6                                        U]..

Creating an API Project
Once you have your signing certificate fingerprint(SHA1), create or modify a project for your application in the Google APIs Console and register for the Maps API.

To get a project and register for the API:
1. In a browser, navigate to the Google APIs Console.

–> If you haven’t used the Google APIs Console before, you’re prompted to create a project that you use to track your usage of the Google Maps Android API. Click Create Project; the Console creates a new project called “API Project“. On the next page, this name appears in the upper left hand corner. To rename or otherwise manage the project, click on its name.

–> If you’re already using the Google APIs Console, you will immediately see a list of your existing projects and the available services. It’s still a good idea to use a new project for Google Maps Android API, so select the project name in the upper left hand corner and then click Create.

2. You should see a list of APIs and services in the main window. If you don’t, select Services from the left navigation bar.

3) In the list of services displayed in the center of the page, scroll down until you see Google Maps Android API v2. To the right of the entry, click the switch indicator so that it is on.

Note: Carefully see you need to ON service for “Google Maps Android API v2” not for “Google Maps API v2” 🙂 This happens with me that’s why notifying you. 🙂

4) This displays the Google Maps Android API Terms of Service. If you agree to the terms of service, click the checkbox below the terms of service, then click Accept. This returns you to the list of APIs and services.

You’re now ready to get a Maps API key.

Obtaining an API Key
If your application is registered with the Google Maps Android API v2 service, then you can request an API key. It’s possible to register more than one key per project.

To get the key

1) In the left navigation bar, click API Access.
2) In the resulting page, click Create New Android Key….
3) In the resulting dialog, enter the SHA-1 fingerprint, then a semicolon, then your application’s package name. For example:


4) The Google APIs Console responds by displaying Key for Android apps (with certificates) followed by a forty-character API key, for example:


5) Copy this key value. You will use it in the next step.

Adding the API Key to your application
The final step is to add the API key to your application. It goes in your application’s manifest, contained in the file AndroidManifest.xml. From there, the Maps API reads the key value and passes it to the Google Maps server, which then confirms that you have access to Google Maps data.

To add the key to your application:

1. In AndroidManifest.xml, add the following element as a child of the <application> element, by inserting it just before the closing tag </application>


substituting your API key for your_api_key. This element sets the key com.google.android.maps.v2.API_KEY to the value your_api_key and makes the API key visible to any MapFragment or SupportMapFragment in your application.

2. Add the following elements to your manifest. Replace com.example.mapdemo with the package name of your application.

        <uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/>

3. Save AndroidManifest.xml and re-build your application.

Step 3:

Specify settings in the Application Manifest.

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

Also Requiring OpenGL ES version 2 permission


Step 4:

Add a map

After you’ve added
a) References to the Google Play services SDK
b) Added your key and
c) Customized your Android Manifest
now you can try adding a map to your application.

Please note that the code below is only useful for testing your settings in an application targeting Android API 12 or later.

1. In main.xml, add the following fragment.

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"

2. In MainActivity.java, add the following code.

package com.example.mapdemo;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

    protected void onCreate(Bundle savedInstanceState) {

3. Build and run your application. You should see a map. If you don’t see a map, confirm that you’ve completed all of the steps appearing earlier in this tutorial.

For the Applications that are targeting API 8 and above use the following code:
1) In main.xml, add the following fragment.


Note the above field class, we have used SupportMapFragment. 🙂

2. In MainActivity.java, add the following code.

package com.example.mapdemo;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class MapsActivity extends FragmentActivity {

    public void onCreate(Bundle savedInstanceState) {


Note here MainActivity extending FragmentActivity 🙂

3. Run the application, it must show the map.

Enjoy Map API Ver2… 🙂 😀

Improvements in Google Map Android API ver2:
1) More dynamic and flexible UI designs for large screen Android devices, such as tablets, using Android Fragments. So now you need not have extend MapActivity if you are using fragment.
2) Maps are now 3D.
3) You can rotate the map smoothly in any direction you want.
4) If you closely watch Map v1 API, map used to over-zoom while zooming-in or zooming-out. In Map v2, it is solved and have really good user look-and-feel when using Maps.

AUTHOR: Vikas Hiran
  • HoussemZAIER

    First of all Thank you for this tutorial it was clear and nice.
    My application run but with a white screen and having this text “Unknown issue with google Play serveices”
    What should I do ?

    December 27, 2012
    • Karthick

      I am getting this error while run my code

      android.view.InflateException: Binary XML file line #11: Error inflating class fragment



      and my java code

      package com.example;

      import android.app.Activity;
      import android.os.Bundle;

      import android.support.v4.app.FragmentActivity;
      import android.view.Menu;

      public class MainActivity extends Activity {

      protected void onCreate(Bundle savedInstanceState) {

      public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;


      My target is gelly bean
      i dont know…how to solve this…please reply me…thanks advance

      September 10, 2013
  • Thanks 4 tutorial.. but im getting force close and logcat not showing error.. Why?

    January 26, 2013
    • We really cannot answer until you show us logcat. Try using command line prompt to view logcat using “adb logcat” command in ~/platform-tools directory. Thanks.

      January 29, 2013
  • sharic19

    The application was installed and started successfully, but why is it that it doesn’t load any maps?

    January 28, 2013
    • Make sure, API key which you generated is correct.

      January 29, 2013
    • Hi there ,i have been through this blank screen for a very long time and tried out all solutions u can imagine.Now it solved and the steps were:

      1-Go through all steps of this toturial carefully.

      2-If the blank screen still the same ,delete you debug key store file that exists in
      c:UsersyouUser.androiddebug.keystore preferences–>android–>Build
      copy the fresh generated SHA1 and then follow the normal key generation steps .
      5-Run on your real device ,and i hope you’ll see your map 🙂

      September 4, 2013
  • prashant

    i have done all these stpe but till getting classnotfoundexception…..plz hepl me

    February 5, 2013
    • For which class it showing classnotfound exception?

      February 12, 2013
  • Son

    Hi, i wanted use Google Maps API v2 for android 2.2, then i set in map.xml:

    (btw. you forget xmlns:adnroid section??)
    And next i extend my activity from FragmentActivity, but NetBeans(dont kill me ;P) dont see FragmentActivity(Eclipse too). I have in libs google-play-services_lib folder.
    Do you have any clue for me??

    February 11, 2013
    • Yes, you will need to add android-support library to use FragmentActivity.

      February 12, 2013
  • Son

    Yeah, that works thx for help 🙂

    February 12, 2013
  • RF

    i had tried it on my handphone but force closed, please help me, best regards..

    March 5, 2013
  • RF

    the log cat is like this,

    03-06 05:47:58.509: D/AndroidRuntime(1633): Shutting down VM
    03-06 05:47:58.509: W/dalvikvm(1633): threadid=1: thread exiting with uncaught exception (group=0x40020578)
    03-06 05:47:58.529: E/AndroidRuntime(1633): FATAL EXCEPTION: main
    03-06 05:47:58.529: E/AndroidRuntime(1633): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cgmav2/com.cgmav2.CgmapV2MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.os.Handler.dispatchMessage(Handler.java:99)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.os.Looper.loop(Looper.java:130)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.app.ActivityThread.main(ActivityThread.java:3687)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at java.lang.reflect.Method.invokeNative(Native Method)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at java.lang.reflect.Method.invoke(Method.java:507)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at dalvik.system.NativeStart.main(Native Method)
    03-06 05:47:58.529: E/AndroidRuntime(1633): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.app.Activity.setContentView(Activity.java:1657)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at com.cgmav2.CgmapV2MainActivity.onCreate(CgmapV2MainActivity.java:13)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
    03-06 05:47:58.529: E/AndroidRuntime(1633): … 11 more
    03-06 05:47:58.529: E/AndroidRuntime(1633): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.support.v4.app.Fragment.instantiate(Fragment.java:401)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    03-06 05:47:58.529: E/AndroidRuntime(1633): … 20 more
    03-06 05:47:58.529: E/AndroidRuntime(1633): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment in loader dalvik.system.PathClassLoader[/data/app/com.cgmav2-1.apk]
    03-06 05:47:58.529: E/AndroidRuntime(1633): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    03-06 05:47:58.529: E/AndroidRuntime(1633): at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
    03-06 05:47:58.529: E/AndroidRuntime(1633): … 23 more
    03-06 05:51:26.629: D/AndroidRuntime(1735): Shutting down VM
    03-06 05:51:26.629: W/dalvikvm(1735): threadid=1: thread exiting with uncaught exception (group=0x40020578)
    03-06 05:51:26.639: E/AndroidRuntime(1735): FATAL EXCEPTION: main
    03-06 05:51:26.639: E/AndroidRuntime(1735): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cgmav2/com.cgmav2.CgmapV2MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.os.Handler.dispatchMessage(Handler.java:99)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.os.Looper.loop(Looper.java:130)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.app.ActivityThread.main(ActivityThread.java:3687)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at java.lang.reflect.Method.invokeNative(Native Method)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at java.lang.reflect.Method.invoke(Method.java:507)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at dalvik.system.NativeStart.main(Native Method)
    03-06 05:51:26.639: E/AndroidRuntime(1735): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.app.Activity.setContentView(Activity.java:1657)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at com.cgmav2.CgmapV2MainActivity.onCreate(CgmapV2MainActivity.java:13)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
    03-06 05:51:26.639: E/AndroidRuntime(1735): … 11 more
    03-06 05:51:26.639: E/AndroidRuntime(1735): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.support.v4.app.Fragment.instantiate(Fragment.java:401)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    03-06 05:51:26.639: E/AndroidRuntime(1735): … 20 more
    03-06 05:51:26.639: E/AndroidRuntime(1735): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment in loader dalvik.system.PathClassLoader[/data/app/com.cgmav2-2.apk]
    03-06 05:51:26.639: E/AndroidRuntime(1735): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    03-06 05:51:26.639: E/AndroidRuntime(1735): at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
    03-06 05:51:26.639: E/AndroidRuntime(1735): … 23 more
    03-06 05:51:56.989: D/AndroidRuntime(1829): Shutting down VM
    03-06 05:51:56.989: W/dalvikvm(1829): threadid=1: thread exiting with uncaught exception (group=0x40020578)
    03-06 05:51:57.019: E/AndroidRuntime(1829): FATAL EXCEPTION: main
    03-06 05:51:57.019: E/AndroidRuntime(1829): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cgmav2/com.cgmav2.CgmapV2MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.os.Handler.dispatchMessage(Handler.java:99)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.os.Looper.loop(Looper.java:130)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.app.ActivityThread.main(ActivityThread.java:3687)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at java.lang.reflect.Method.invokeNative(Native Method)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at java.lang.reflect.Method.invoke(Method.java:507)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at dalvik.system.NativeStart.main(Native Method)
    03-06 05:51:57.019: E/AndroidRuntime(1829): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.app.Activity.setContentView(Activity.java:1657)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at com.cgmav2.CgmapV2MainActivity.onCreate(CgmapV2MainActivity.java:13)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
    03-06 05:51:57.019: E/AndroidRuntime(1829): … 11 more
    03-06 05:51:57.019: E/AndroidRuntime(1829): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.support.v4.app.Fragment.instantiate(Fragment.java:401)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    03-06 05:51:57.019: E/AndroidRuntime(1829): … 20 more
    03-06 05:51:57.019: E/AndroidRuntime(1829): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment in loader dalvik.system.PathClassLoader[/data/app/com.cgmav2-2.apk]
    03-06 05:51:57.019: E/AndroidRuntime(1829): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    03-06 05:51:57.019: E/AndroidRuntime(1829): at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
    03-06 05:51:57.019: E/AndroidRuntime(1829): … 23 more

    what i must to do to make it run?

    March 5, 2013
  • Jet

    THANK YOU! for this great tutorial…i’ve been figure out how to get v2 Maps to work on my Android 2.2.1 phone. Been trying to put the bits and pieces together from Google materials with no luck. This tutorial clearly and concisely told me exactly what I needed to know. Gosh I wish the Google folk’s documentation was 1/10th as clear as this tutorial. They need to read your stuff and take notes on how to do it!

    Thank you again.

    March 21, 2013
  • Ravi

    Excellent post. Explanation if too good. I want to know does Google Maps API v2 works in Android that have verions less than 8.


    April 18, 2013
  • Ravi

    Excellent post. Explanation is too good. I want to know does Google Maps API v2 works in Android that have verions less than 8.

    April 18, 2013
  • carlos vences

    Hi i followed this tutorial and others but i still having a problem. when i running my app shows “unfortunately appname has stopped” , could you help me?

    this is my log

    12-17 00:09:03.928: E/AndroidRuntime(3536): FATAL EXCEPTION: main
    12-17 00:09:03.928: E/AndroidRuntime(3536): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.minimapa/com.example.minimapa.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.app.ActivityThread.access$1500(ActivityThread.java:121)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.os.Handler.dispatchMessage(Handler.java:99)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.os.Looper.loop(Looper.java:123)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.app.ActivityThread.main(ActivityThread.java:3701)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at java.lang.reflect.Method.invokeNative(Native Method)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at java.lang.reflect.Method.invoke(Method.java:507)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at dalvik.system.NativeStart.main(Native Method)
    12-17 00:09:03.928: E/AndroidRuntime(3536): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:227)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.app.Activity.setContentView(Activity.java:1657)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at com.example.minimapa.MainActivity.onCreate(MainActivity.java:11)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    12-17 00:09:03.928: E/AndroidRuntime(3536): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)

    December 17, 2013
  • mustafa

    me too having same problem:
    unfortunately appname has stopped …Force close!
    Logcat does not describe anything clear. What should I do?

    July 4, 2014

Leave a Comment

Your email address will not be published.