title: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
body: <p><br>
  I have the following problem:
  I have a FragmentActivity with two fragments. In one of them there's a MapFragment. If I open the Fragment with the map the first time all is running perfectly. But when I navigate back to the first Fragment and then open the Fragment with the map again the app crashes with the following LogCat output:</p>
  
  <pre><code>    02-02 17:01:28.589: E/AndroidRuntime(13587): FATAL EXCEPTION: main
      02-02 17:01:28.589: E/AndroidRuntime(13587): Process: de.simeon.maps, PID: 13587
      02-02 17:01:28.589: E/AndroidRuntime(13587): android.view.InflateException: Binary XML file line #1: Error inflating class fragment
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:547)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.view.LayoutInflater.inflate(Native Method)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at de.simeon.maps.MainActivity$Map.onCreateView(MainActivity.java:141)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.os.Handler.handleCallback(Handler.java:733)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.os.Handler.dispatchMessage(Handler.java:95)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.os.Looper.loop(Looper.java:136)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.app.ActivityThread.main(ActivityThread.java:5017)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at java.lang.reflect.Method.invokeNative(Native Method)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at java.lang.reflect.Method.invoke(Method.java:515)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at dalvik.system.NativeStart.main(Native Method)
      02-02 17:01:28.589: E/AndroidRuntime(13587): Caused by: java.lang.IllegalArgumentException: Binary XML file line #1: Duplicate id 0x7f050006, tag null, or parent id 0x7f050005 with another fragment for com.google.android.gms.maps.MapFragment
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.app.Activity.onCreateView(Activity.java:4791)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
      02-02 17:01:28.589: E/AndroidRuntime(13587):    ... 22 more
  </code></pre>
  
  <p><br><b>My Fragment with the map:</b></p>
  
  <pre><code>    public static class Map extends Fragment {
  
      public Map() {
  
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          View rootView = inflater.inflate(R.layout.fragment_map, container, false);
  
  
          return rootView;
      }
  }
  </code></pre>
  
  <p><br><b>My fragment_map.xml:</b></p>
  
  <pre><code>&lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/map"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:name="com.google.android.gms.maps.MapFragment"
      tools:context=".MainActivity$Map"
      tools:ignore="MergeRootFrame"/&gt;
  </code></pre>
  
  <p><br><b>My AndroidManifest.xml:</b></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="de.simeon.maps"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;permission 
                 android:name="example.gps.permission.MAPS_RECEIVE" 
                 android:protectionLevel="signature"&gt;&lt;/permission&gt;
  
      &lt;uses-sdk
          android:minSdkVersion="14"
          android:targetSdkVersion="18" /&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="com.google.android.providers.gsf.permission.READ_GSERVICES" /&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-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;meta-data
              android:name="com.google.android.gms.version"
              android:value="@integer/google_play_services_version" /&gt;
          &lt;meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="AIzaSyD6KQk5r39QnU_M5JOJwA3klu7jsXMD7Jk" /&gt;
  
          &lt;activity
              android:name="de.simeon.maps.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;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p><br>Could you please help me?</p>