Fragment with TextInputLayout crashes app on Android Marshmallow
<p>I've discovered the following issue. I use Material Design' class <code>android.support.design.widget.TextInputLayout</code> in XML layout.</p>

<p>When I inflate this layout in fragment, my app falls with the following error:</p>

<pre><code>android.view.InflateException: Binary XML file line #563: Error inflating class &lt;unknown&gt;
</code></pre>

<p>The fall occures on <strong>Samsung Galaxy S7</strong> with <strong>Android 6.0.1</strong>. When I start the app on <strong>Lenovo A319</strong> with <strong>Android 4.4.2</strong> everything goes fine, no crash.
When I use XML layout with <code>android.support.design.widget.TextInputLayout</code> class for activity <em>(without any fragments)</em>, <strong>Galaxy S7</strong> works fine too.</p>

<p>It seems that there is something wrong on Marshmallow when app tries to inflate <code>android.support.design.widget</code> classes in fragment.</p>

<p><strong>Is there some way to fix that?</strong></p>

<p>Here is my code:</p>

<p><strong>DocumentEditFragment.java</strong></p>

<pre><code>public class DocumentEditFragment extends BaseFragment {
...
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View view = inflater.inflate(R.layout.fragment_document_edit, container, false); // The app falls here on Galaxy S7
...
}
</code></pre>

<p><strong>DocumentActivity.java</strong></p>

<pre><code>public class DocumentActivity extends AppCompatActivity {
    private DocumentEditFragment docEditFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_document);
        docEditFragment = new DocumentEditFragment();
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.fragment_document, docEditFragment);
        ft.commit();
    }
}
</code></pre>

<p><strong>fragment_document_edit.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="0dp"
android:layout_margin="0dp"

    &lt;ScrollView
    android:id="@+id/doc_edit_scroll_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:layout_marginLeft="16dp"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    &gt;
...
&lt;!-- line #563 is below: --&gt;
        &lt;android.support.design.widget.TextInputLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="22dp"
        android:layout_marginLeft="60dp"
        android:layout_marginRight="16dp"
        app:errorEnabled="true"
        android:theme="@style/TextLabel"
        &gt;

        &lt;android.support.v7.widget.AppCompatEditText
            android:id="@+id/doc_edit_comment"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="14sp"
            android:text="1st line\n2nd line"
            android:singleLine="false"
            android:hint="Comment"
            android:textColorHint="#69202020"
            /&gt;

    &lt;/android.support.design.widget.TextInputLayout&gt;

    &lt;/ScrollView&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p><strong>activity_document.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_document"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="my.app.DocumentFragment"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
tools:context="my.app.DocumentFragment"
/&gt;
</code></pre>

<p><strong>UPDATE:</strong></p>

<p>I've uploaded the sample project that produces the same error on <strong>Galaxy S7 edge</strong> as my working project does <em>(I cannot make public the corporate project)</em>. Here is the repository <a href="https://github.com/YanaArtis/Fragment_with_TextInputLayout_Example" rel="nofollow noreferrer"><strong>link</strong></a>.</p>

<p><strong>SOLVED</strong></p>

<p>I've moved the attribute
<code>android:theme="@style/TextLabel"</code>
from <code>&lt;android.support.design.widget.TextInputLayout /&gt;</code> into <code>&lt;android.support.v7.widget.AppCompatEditText /&gt;</code> - and everything goes fine! Thanks to Nico from Udacity for wise advice!</p>