android.support.design.widget.TextInputLayout could not be instantiated

SHIDHIN.T.S picture SHIDHIN.T.S · Jul 17, 2016 · Viewed 53.6k times · Source

I want to integrate android.support.design.widget.TextInputLayout In my android application. I have copied the jar file android-support-design.jar from the sdk to my applications lib folder. I have added below code in my xml file for the Email EditText,

 <!-- Email Label -->
        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="8dp">
            <EditText android:id="@+id/input_email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textEmailAddress"
                android:hint="Email" />
        </android.support.design.widget.TextInputLayout>

While add this code in my layout.xml file I am getting an error like,

Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be instantiated:
- android.support.design.widget.TextInputLayout (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.

How can i fix this issue...

Answer

Sai Gopi Me picture Sai Gopi Me · Jun 25, 2019

replace

android.support.design.widget.TextInputLayout

with

com.google.android.material.textfield.TextInputLayout