com.android.support:design with androidX(1.0.2) [英] com.android.support:design with androidX (1.0.2)

查看:107
本文介绍了com.android.support:design with androidX(1.0.2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在项目中使用TextInputLayout,但是我使用androidX库

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

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:在路径:DexPathList [[zip file"/data/app/com.example

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

推荐答案

膨胀类android.support.design.widget.TextInputLayout的错误原因:java.lang.ClassNotFoundException:找不到类

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

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

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.

您应该使用

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>

然后 Clean-Rebuild-Run .

Then Clean-Rebuild-Run.

这篇关于com.android.support:design with androidX(1.0.2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆