title: Don't understand why I'm getting "Error inflating class Fragment"
body: <p>I'm learning how to work with fragments in Android and I worked on the Google fragment example to build a sample fragment. However it keeps giving me this error</p>
  
  <pre><code>08-08 02:31:31.887: E/AndroidRuntime(2073): FATAL EXCEPTION: main
  08-08 02:31:31.887: E/AndroidRuntime(2073): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tesingfragments/com.example.tesingfragments.MainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class Fragment
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.os.Handler.dispatchMessage(Handler.java:99)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.os.Looper.loop(Looper.java:137)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.app.ActivityThread.main(ActivityThread.java:5103)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at java.lang.reflect.Method.invokeNative(Native Method)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at java.lang.reflect.Method.invoke(Method.java:525)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at dalvik.system.NativeStart.main(Native Method)
  08-08 02:31:31.887: E/AndroidRuntime(2073): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class Fragment
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.app.Activity.setContentView(Activity.java:1895)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at com.example.tesingfragments.MainActivity.onCreate(MainActivity.java:14)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.app.Activity.performCreate(Activity.java:5133)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     ... 11 more
  08-08 02:31:31.887: E/AndroidRuntime(2073): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.Fragment" on path: DexPathList[[zip file "/data/app/com.example.tesingfragments-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.tesingfragments-1, /system/lib]]
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.view.LayoutInflater.createView(LayoutInflater.java:559)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
  08-08 02:31:31.887: E/AndroidRuntime(2073):     ... 21 more
  </code></pre>
  
  <p>This is what I did.</p>
  
  <p>MainActivity</p>
  
  <pre><code>package com.example.tesingfragments;
  
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.ListFragment;
  import android.view.Menu;
  
  public class MainActivity extends FragmentActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      @Override
      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;
      }
  
  }
  </code></pre>
  
  <p>MainActivity layout</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".MainActivity" &gt;
  
  
      &lt;fragment
          android:name="com.example.tesingfragments.Fragment1"
          android:id="@+id/fragment1"
          android:layout_weight="1"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          /&gt;
      &lt;fragment
          android:name="com.example.tesingfragments.Fragment2"
          android:id="@+id/fragment2"
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
          /&gt; 
     &lt;!--  &lt;TextView
       android:id="@+id/texter1"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="Fragment 1"
       /&gt;--&gt; 
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Fragment 1</p>
  
  <pre><code>package com.example.tesingfragments;
  
  
  import android.app.Fragment;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.ListFragment;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  
  public class Fragment1 extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.fragmenter, container, false);
      }
  
  }
  </code></pre>
  
  <p>Fragment 1 layout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
   &lt;TextView
       android:id="@+id/text1"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="Fragment 1"
       /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Fragment 2</p>
  
  <pre><code>package com.example.tesingfragments;
  
  
  import android.app.Fragment;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.ListFragment;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  
  public class Fragment2 extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.fragment, container, false);
      }
  
  }
  </code></pre>
  
  <p>Fragment 2 layout</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
   &lt;TextView
       android:id="@+id/text2"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="Fragment 2"
       /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>This is my explorer view so you can see that I named the classes properly.</p>
  
  <p><img src="https://i.stack.imgur.com/t3OPS.png" alt="This"></p>