title: Android Google Map API V2 - Error Inflating Class Fragment
body: <p>I have been following Googles guide to making an app that allows you to view an app on an Android phone. I have followed many tutorials, but always end up with the same error! I have also searched around the web and figured my error is something to do with the "fragment". Here are my files:</p>
  
  <h3>MainActivity.java</h3>
  
  <pre><code>package com.example.theapp;
  
  import android.app.Activity;
  import android.os.Bundle;
  
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  }
  </code></pre>
  
  <h3>activity_main.xml</h3>
  
  <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"
            android:name="com.google.android.gms.maps.MapFragment"/&gt;
  </code></pre>
  
  <h3>AndroidManifest.xml</h3>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.theapp"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
      android:minSdkVersion="8"
      android:targetSdkVersion="19" /&gt;
  
  &lt;permission
      android:name="com.example.theapp.permission.MAPS_RECEIVE"
      android:protectionLevel="signature"/&gt;
  
  &lt;uses-permission android:name="com.example.theapp.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;meta-data
      android:name="com.google.android.maps.v2.API_KEY"
      android:value="--REMOVED--"/&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.example.theapp.MainActivity"
          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.gms.version"
          android:value="@integer/google_play_services_version" /&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>I am using Android 2.3. Here is the log cat messages:</p>
  
  <pre><code>04-02 22:43:45.890: D/AndroidRuntime(23773): Shutting down VM
  04-02 22:43:45.890: W/dalvikvm(23773): threadid=1: thread exiting with uncaught exception    (group=0x40018578)
  04-02 22:43:45.898: E/AndroidRuntime(23773): FATAL EXCEPTION: main
  04-02 22:43:45.898: E/AndroidRuntime(23773): java.lang.RuntimeException: Unable to start   activity ComponentInfo{com.example.theapp/com.example.theapp.MainActivity}:   android.view.InflateException: Binary XML file line #2: Error inflating class fragment
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.os.Handler.dispatchMessage(Handler.java:99)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.os.Looper.loop(Looper.java:130)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.app.ActivityThread.main(ActivityThread.java:3687)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at java.lang.reflect.Method.invoke(Method.java:507)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at dalvik.system.NativeStart.main(Native Method)
  04-02 22:43:45.898: E/AndroidRuntime(23773): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.app.Activity.setContentView(Activity.java:1657)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at com.example.theapp.MainActivity.onCreate(MainActivity.java:11)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    ... 11 more
  04-02 22:43:45.898: E/AndroidRuntime(23773): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.theapp-1.apk]
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.view.LayoutInflater.createView(LayoutInflater.java:471)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
  04-02 22:43:45.898: E/AndroidRuntime(23773):    ... 19 more
  04-02 22:55:53.289: D/AndroidRuntime(23942): Shutting down VM
  04-02 22:55:53.289: W/dalvikvm(23942): threadid=1: thread exiting with uncaught exception (group=0x40018578)
  04-02 22:55:53.304: E/AndroidRuntime(23942): FATAL EXCEPTION: main
  04-02 22:55:53.304: E/AndroidRuntime(23942): java.lang.RuntimeException: Unable to start  activity ComponentInfo{com.example.theapp/com.example.theapp.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.os.Handler.dispatchMessage(Handler.java:99)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.os.Looper.loop(Looper.java:130)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.app.ActivityThread.main(ActivityThread.java:3687)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at java.lang.reflect.Method.invokeNative(Native Method)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at java.lang.reflect.Method.invoke(Method.java:507)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at dalvik.system.NativeStart.main(Native Method)
  04-02 22:55:53.304: E/AndroidRuntime(23942): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.app.Activity.setContentView(Activity.java:1657)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at com.example.theapp.MainActivity.onCreate(MainActivity.java:11)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    ... 11 more
  04-02 22:55:53.304: E/AndroidRuntime(23942): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.theapp-2.apk]
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.view.LayoutInflater.createView(LayoutInflater.java:471)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
  04-02 22:55:53.304: E/AndroidRuntime(23942):    ... 19 more
  </code></pre>
  
  <p>Any help would be appreciated. Thank you in advance.</p>