Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android.support.design.widget.TextInputLayout failed to instantiate

I am getting error while try to use TextInputLayout in android

I have android support library version 23. but still getting error

my xml file showing error is

he 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.


11-25 00:58:30.967: E/AndroidRuntime(27848): Caused by: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
11-25 00:58:30.967: E/AndroidRuntime(27848):    at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:34)
11-25 00:58:30.967: E/AndroidRuntime(27848):    at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:103)
11-25 00:58:30.967: E/AndroidRuntime(27848):    at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:96)
11-25 00:58:30.967: E/AndroidRuntime(27848):    ... 24 more


11-25 13:32:29.967: E/AndroidRuntime(18136): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.TextInputLayout" on path: DexPathList[[zip file "/data/app/com.odibly.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.odibly.android-1/lib/arm, /vendor/lib, /system/lib]]

11-25 13:32:29.967: E/AndroidRuntime(18136):    Suppressed: java.lang.ClassNotFoundException: android.support.design.widget.TextInputLayout
like image 266
Komal Nikhare Avatar asked Nov 26 '15 13:11

Komal Nikhare


2 Answers

You need to add the following to your module build.gradle file:

implementation 'com.google.android.material:material:1.0.0'

And use com.google.android.material.textfield.TextInputLayout in your XML:

   <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/text_input_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/my_hint">
like image 159
rmtheis Avatar answered Nov 10 '22 16:11

rmtheis


You need to add this dependency in the gradle file

compile 'com.android.support:design:23.1.1'
like image 4
Nigam Patro Avatar answered Nov 10 '22 16:11

Nigam Patro