[英]cannot resolve symbol while importing constraintlayout in android studio 3.4.2
我是android的初学者并创建一个程序,完成了所有工作,但是当使用导入语句'import android.support.constraint.ConstraintLayout'代码编辑器导入constraintlayout时,红色高亮显示“无法解析符号”。
您可以尝试使用androidx或使用支持库的28.0.0-alpha1版本
Refactor and migrate your code to Android X. 重构代码并将其迁移到AndroidX。
Then add this in your build.gradle
file app level. 然后将其添加到
build.gradle
文件应用程序级别。
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
It's a bit hard to guess what the problem is without a code snippet or screenshot of how you're using constraint layout in your XML but I imagine this Gradle issue is caused you have not imported constraint layout to your build.gradle file. 没有代码片段或如何在XML中使用约束布局的屏幕截图,很难猜测问题出在哪里,但是我想这个Gradle问题是由于您尚未将约束布局导入到build.gradle文件中。 Make sure this is in your build.gradle file in the dependencies section:
确保这是在您的build.gradle文件中的依赖项部分中:
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
The importing statment is as ... 进口说明如下:
import android.support.constraint.ConstraintLayout; 导入android.support.constraint.ConstraintLayout;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.