Komal Nikhare
Komal Nikhare

Reputation: 252

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

Upvotes: 9

Views: 13882

Answers (3)

rmtheis
rmtheis

Reputation: 5826

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">

Upvotes: 17

Jorgesys
Jorgesys

Reputation: 126455

Definitelly, you need to add the dependency inside the build.gradle file located inside /app

dependencies {
    ...
    implementation 'com.android.support:design:27.0.1' //change compile to implementation
    ...
    }
}

but if you are still using Eclipse probably will have some problems using the support library, i recommend to start using Android Studio.

The Eclipse ADT plugin is no longer supported per our announcement. Android Studio is now the official IDE for Android, so you should migrate your projects to Android Studio as soon as possible. For more information on transitioning to Android Studio, see Migrate to Android Studio from Eclipse.

Upvotes: 0

Nigam Patro
Nigam Patro

Reputation: 2770

You need to add this dependency in the gradle file

compile 'com.android.support:design:23.1.1'

Upvotes: 4

Related Questions