title: Android Google map V2: Binary XML file line #1: Error inflating class fragment
body: <p>I was error facing inflating class fragment while integrating Google Map V2 with my application. </p>
  
  <p>I started with,</p>
  
  <ol>
  <li>Got SHA1 hash and created map key for android.</li>
  <li>Imported google-play-services as library project(with copy to workspace) and added as a reference library.</li>
  </ol>
  
  <p>I have looked into various solutions, but nothing solves my issue. 
  Please can anyone hep me on this? Help is really appreciable. Thanks in advance!</p>
  
  <pre><code>04-07 09:14:56.387: E/AndroidRuntime(13151): FATAL EXCEPTION: main
  04-07 09:14:56.387: E/AndroidRuntime(13151): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.toyota.dealerparking/com.toyota.dealerparking.GMapActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.os.Handler.dispatchMessage(Handler.java:99)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.os.Looper.loop(Looper.java:130)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.app.ActivityThread.main(ActivityThread.java:3687)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at java.lang.reflect.Method.invoke(Method.java:507)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at dalvik.system.NativeStart.main(Native Method)
  04-07 09:14:56.387: E/AndroidRuntime(13151): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.app.Activity.setContentView(Activity.java:1657)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at com.toyota.dealerparking.GMapActivity.onCreate(GMapActivity.java:11)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    ... 11 more
  04-07 09:14:56.387: E/AndroidRuntime(13151): 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
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.support.v4.app.Fragment.instantiate(Fragment.java:401)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    ... 19 more
  04-07 09:14:56.387: E/AndroidRuntime(13151): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment in loader dalvik.system.PathClassLoader[/data/app/com.toyota.dealerparking-2.apk]
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
  04-07 09:14:56.387: E/AndroidRuntime(13151):    ... 22 more
  </code></pre>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.toyota.dealerparking"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="17" /&gt;
  
      &lt;permission
          android:name="com.toyota.dealerparking.permission.MAPS_RECEIVE"
          android:protectionLevel="signature" /&gt;
  
      &lt;uses-feature android:name="android.hardware.camera" /&gt;
  
      &lt;uses-permission android:name="com.toyota.dealerparking.permission.MAPS_RECEIVE" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
      &lt;!--
       The following two permissions are not required to use
       Google Maps Android API v2, but are recommended.
      --&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  
      &lt;uses-feature
          android:glEsVersion="0x00020000"
          android:required="true" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.toyota.dealerparking.GMapActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="my-key" /&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>GMapActivity.java</p>
  
  <pre><code>package com.toyota.dealerparking;
  
  import android.app.Activity;
  import android.os.Bundle;
  
  public class GMapActivity extends Activity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.map);
      }
  }
  </code></pre>
  
  <p>map.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/map"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      class="com.google.android.gms.maps.SupportMapFragment" /&gt;
  </code></pre>