Issue
I'm trying to use android MotionLayout, but it can't find appropriate classes for it and wont work.
I tried implementing the below dependencies:
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha4'
but none of them seems to work...
here is my XML file:
<android.support.constraint.motion.MotionLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
footstools="http://schemas.android.com/tools"
android:id="@+id/motionLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:showPaths="true"
tools:context=".PlayGameActivity">
<View
android:id="@+id/button"
android:layout_width="64dp"
android:layout_height="64dp"
android:background="@color/colorAccent"
android:text="Button" />
</android.support.constraint.motion.MotionLayout >'
but it gives me always this error massage:
Missing classes
The following classes could not be found:
- android.support.constraint.motion.MotionLayout (Fix Build Path, Edit XML, Create Class)
Tip: Try to build the project.
Tip: Try to refresh the layout.
and in the preview window of the projects it fills the entire layout in gray and writes in the center:
android...MotionLayout
Solution
There is no android.support.constraint.motion.MotionLayout
in implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta2"
.
It's called androidx.constraintlayout.motion.widget.MotionLayout
.
If MotionLayout
shows up gray, you might be lacking the app:layoutDescription
XML.
There's an example for AndroidX & Support Library versions.
Answered By - Martin Zeitler
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.