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

3

我想在我的项目中使用TextInputLayout,但我正在使用androidX库。

implementation "androidx.appcompat:appcompat:1.0.2"

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

我遇到的异常是:

android.view.InflateException: 二进制XML文件第30行:二进制XML文件第30行:无法填充类android.support.design.widget.TextInputLayout 原因:android.view.InflateException: 二进制XML文件第30行:无法填充类android.support.design.widget.TextInputLayout 原因:java.lang.ClassNotFoundException:在路径上找不到类“android.support.design.widget.TextInputLayout”:DexPathList[[zip文件“/data/app/com.example

1个回答

7

错误充气类android.support.design.widget.TextInputLayout Caused by: java.lang.ClassNotFoundException: 找不到类

当Java虚拟机(JVM)尝试加载特定类并且在类路径中找不到指定类时,会抛出此错误。

您应该使用:

com.google.android.material.textfield.TextInputLayout

示例

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

然后执行清理-重建-运行

1
对我有用,谢谢。 - Mohammad Al-Hussein

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接