title: Android Error: Binary XML file line #11: Error inflating class fragment when using map fragment
body: <p>I'm trying to display map using map api v2.
  I searched for the answer similar to my problem.
  On Jul 23, "Android Error: Binary XML file line #16: Error inflating class fragment when adding map fragment."
  And I changed my sources according to the answer.
  But still I have a problem when using map fragment.
  Any help is appreciated. Thank you. </p>
  
  <p>Here is my xml code:</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 
      class="com.google.android.gms.maps.MapFragment"
      android:layout_width="match_parent"
      android:layout_height="match_parent" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Here is Code in activity:</p>
  
  <pre><code>package com.example.googlemap;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.support.v4.app.*;
  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) {
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  }
  </code></pre>
  
  <p>Here's manifest file:</p>
  
  <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.googlemap"
    android:versionCode="1"
    android:versionName="1.0" &gt;
  
    &lt;uses-sdk android:minSdkVersion="12"
            android:targetSdkVersion="16" /&gt;
    &lt;uses-feature android:required="true"
               android:glEsVersion="0x00020000"/&gt;
    &lt;permission android:name="com.example.googlemap.permission.MAPS_RECEIVE" 
      android:protectionLevel="signature"/&gt;
    &lt;uses-permission android:name="com.example.googlemap.permission.MAPS_RECEIVE"/&gt;
    &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
    &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&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-permission android:name ="com.google.android.providers.gsf.permission.READ_GSERVICES"/&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.googlemap.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.maps.v2.API_KEY"
                 android:value="API key" /&gt;
    &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>I'm trying to run it on my device (Andorid 4.1.2 which is api 16).
  I've added google-play-services-lib in my procject.
  When I run app, it just crashes.
  Here is full logcat log:</p>
  
  <pre><code>11-15 17:53:35.785: E/AndroidRuntime(23708): FATAL EXCEPTION: main
  11-15 17:53:35.785: E/AndroidRuntime(23708): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemap/com.example.googlemap.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2081)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2106)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.ActivityThread.access$600(ActivityThread.java:138)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1204)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.os.Handler.dispatchMessage(Handler.java:99)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.os.Looper.loop(Looper.java:137)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.ActivityThread.main(ActivityThread.java:4911)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at java.lang.reflect.Method.invokeNative(Native Method)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at java.lang.reflect.Method.invoke(Method.java:511)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at dalvik.system.NativeStart.main(Native Method)
  11-15 17:53:35.785: E/AndroidRuntime(23708): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:408)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.Activity.setContentView(Activity.java:2094)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at com.example.googlemap.MainActivity.onCreate(MainActivity.java:13)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.Activity.performCreate(Activity.java:5253)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2045)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    ... 11 more
  11-15 17:53:35.785: E/AndroidRuntime(23708): Caused by: java.lang.IllegalArgumentException: Binary XML file line #11: Must specify unique android:id, android:tag, or have a parent with an id for com.google.android.gms.maps.MapFragment
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.app.Activity.onCreateView(Activity.java:4882)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
  11-15 17:53:35.785: E/AndroidRuntime(23708):    ... 21 more
  </code></pre>