Search code examples
androidandroid-studioandroid-layoutandroidxandroid-design-library

com.android.support:design with androidX (1.0.2)


I want to use TextInputLayout inside my project, but I'm using androidX library

implementation "androidx.appcompat:appcompat:1.0.2"

/*this don't work*/
implementation "com.android.support:design:28.0.0"

This is the exception which I'm facing

android.view.InflateException: Binary XML file line #30: Binary XML file line #30: Error inflating class android.support.design.widget.TextInputLayout Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class android.support.design.widget.TextInputLayout Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.TextInputLayout" on path: DexPathList[[zip file "/data/app/com.example


Solution

  • Error inflating class android.support.design.widget.TextInputLayout Caused by: java.lang.ClassNotFoundException: Didn't find class

    This error thrown when the Java Virtual Machine (JVM) tries to load a particular class and the specified class cannot be found in the classpath.

    You should use

    com.google.android.material.textfield.TextInputLayout
    

    DEMO

      <com.google.android.material.textfield.TextInputLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       >
    
       <com.google.android.material.textfield.TextInputEditText
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           />
    </com.google.android.material.textfield.TextInputLayout>
    

    Then Clean-Rebuild-Run.