Issue
I'm trying to follow a playlist on YouTube by CodingInFlow for Android Studio development.
I'm trying to follow this video, but I'm having a problem... https://www.youtube.com/watch?v=-sPOtGqd5OA&list=PLrnPJCHvNZuBtcos16XJnfFx2fSUOyW_-&index=9
My design-screen is just showing as a gray box and I get the error that the "androidx.constraintlayout.ConstraintLayout (class couldn't be found)."
See code and example image here:
In the videos he's not using AndroidX and his opening-tag is different to mine in his .xml files.
His opening tag for his .xml document: android.support.constraint.ConstraintLayout
My opening tag for my .xml document: androidx.constraintlayout.ConstraintLayout
How can I fix this so that the design will show up where the gray box currently is?
Thank you
Solution
Make sure you have migrated to androidx
https://developer.android.com/jetpack/androidx/migrate
add this line to build.gradle
dependencies {
implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta4"
}
in your xml
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
Answered By - Jaydeep chatrola
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.