title: android <merge /> can be used only with a valid viewgroup root and attachtoroot=true
body: <p>I am trying to inflate a fragment xml that <strong>does not</strong> have merge anywhere in it. Yet I am being given the error stated in the question.</p>
  
  <p>My fragment class :</p>
  
  <pre><code>package com.xxxxx.www.xxxxxx;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class ExcercisePlanFragment extends Fragment
  {
  
      public static ExcercisePlanFragment newInstance()
      {
          ExcercisePlanFragment fragment = new ExcercisePlanFragment();
          return fragment;
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState)
      {
          return inflater.inflate(R.layout.fragment_excercise_plan, container, false);
      }
  }
  </code></pre>
  
  <p>Here is <code>fragment_excercise_plan.xml</code> : </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:background="@color/dark_bg"
      android:orientation="vertical"&gt;
  
      &lt;RelativeLayout
          android:layout_weight="1"
          android:layout_width="match_parent"
          android:layout_height="0dp"&gt;
  
          &lt;Button
              android:layout_width="wrap_content"
              android:layout_height="44dp"
              android:minWidth="88dp"
              android:background="@color/mediumGray"
              android:paddingLeft="24dp"
              android:paddingRight="24dp"
              android:layout_centerInParent="true"
              android:textColor="#FFF"
              android:textSize="14sp"
              android:text="CREATE A PLAN"/&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;RelativeLayout
          android:layout_weight="1"
          android:layout_width="match_parent"
          android:layout_height="0dp"&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerInParent="true"
              android:textColor="#FFF"
              android:textSize="20sp"
              android:text="OR" /&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;RelativeLayout
          android:layout_weight="1"
          android:layout_width="match_parent"
          android:layout_height="0dp"&gt;
  
          &lt;Button
              android:layout_width="wrap_content"
              android:layout_height="44dp"
              android:minWidth="88dp"
              android:background="@color/mediumGray"
              android:paddingLeft="24dp"
              android:paddingRight="24dp"
              android:layout_centerInParent="true"
              android:textColor="#FFF"
              android:textSize="14sp"
              android:text="CHOOSE A PLAN"/&gt;
      &lt;/RelativeLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I have no idea where <code>build.gradle</code> is picking up merge. I have another fragment activity which is working perfectly.</p>