Reputation: 2456
I am using ConstraintLayout 2.0 to do some MotionLayout animations. I updated my ConstraintLayout 2.0 from alpha-3
to beta-3
and now when compiling, it complaints
src/main/res/xml/scene.xml:11: AAPT: error: attribute target (aka com.myapp:target) not found.
I didn't change anything in my MotionLayout scene file. Here's the offending parts:
<MotionScene
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
...
<Transition
motion:constraintSetStart="@+id/start"
motion:constraintSetEnd="@+id/end"
motion:duration="1000">
<KeyFrameSet>
<KeyPosition
motion:target="@+id/accent_background" <<-- Here
motion:framePosition="80"
motion:percentX="1"
motion:percentY="1" />
I looked at the documentation of MotionLayout and to me this has not changed, but the target is still defined like that. Or am I missing something?
I did clear the cache and try to rebuild, but it didn't help.
Upvotes: 1
Views: 1242
Reputation: 2456
Solved it.
The attribute has been renamed to motionTarget
. So the definition should be
<KeyFrameSet>
<KeyPosition
motion:motionTarget="@+id/accent_background"
motion:framePosition="80"
motion:percentX="1"
motion:percentY="1" />
The MotionLayout blog posts by Google (https://medium.com/google-developers/introduction-to-motionlayout-part-i-29208674b10d) have the old attribute names, but documentation has them updated (https://developer.android.com/reference/android/support/constraint/motion/MotionLayout#keyposition)
Upvotes: 10