https://kotlinlang.org logo
#compose
Title
# compose
m

Mikael Ohlson

03/31/2022, 2:48 PM
I'm having some issues with
rememberAnimatedVectorPainter
with an animated vector drawable from a resource, when the drawable contains a "translateXY" property (as seen in some AOSP classes). As far as I can tell, any animated vector drawable containing the object animator below will cause a crash. Is this a known issue, am I just being silly and doing something dumb, or should I report it?
Copy code
<objectAnimator xmlns:android="<http://schemas.android.com/apk/res/android>"
    xmlns:aapt="<http://schemas.android.com/aapt>"
    android:propertyName="translateXY"
    android:duration="500"
    android:startOffset="0"
    android:propertyXName="translateX"
    android:propertyYName="translateY"
    android:pathData="M 12.138,24C -1.1690000000000005,24 17.919,24 12.138,24">
    <aapt:attr name="android:interpolator">
        <pathInterpolator android:pathData="M 0.0,0.0 c0.333,0.168 0.667,1 1.0,1.0" />
    </aapt:attr>
</objectAnimator>
And it is being referenced like this
Copy code
@OptIn(ExperimentalAnimationGraphicsApi::class)
@Composable
fun BadgeIconImage() {
    val image = AnimatedImageVector.animatedVectorResource(R.drawable.triangle_animated_vector)
    var atEnd by remember { mutableStateOf(false) }

    Image(
        painter = rememberAnimatedVectorPainter(image, atEnd),
        contentDescription = "Your content description",
        modifier = Modifier.size(64.dp).clickable {
            atEnd = !atEnd
        }
    )
}
where the triangle_animated_vector just uses the above object animator on a simple triangle. I'm on version 1.1.1 of compose.
The top of the stack trace looks like this. (Taken from the preview, but it crashes identically on device)
d

Doris Liu

03/31/2022, 7:08 PM
Could you please file a bug including the snippets and the stack trace?
m

Mikael Ohlson

03/31/2022, 7:11 PM
@Doris Liu Certainly! I'll do it first thing in the morning when I'm back at work tomorrow! Thanks!
d

Doris Liu

03/31/2022, 7:15 PM
Awesome! Thanks. 🙂
m

Mikael Ohlson

04/01/2022, 9:59 AM
@Doris Liu That took a little longer than I had intended, but here you go: https://issuetracker.google.com/issues/227624422
👍 1
I guess the end-result was that yes, this is an issue, but due to an as-of-yet unsupported feature. @Doris Liu Is there by chance a list of un-supported AVD features available?
d

Doris Liu

04/06/2022, 5:30 PM
We are working through all the features in AVD and support them one by one. Yuichi would be the best person to get that list not-yet-supported features from, so please feel free to ask in the bug. 🙂
m

Mikael Ohlson

04/06/2022, 8:56 PM
Thank you @Doris Liu, I’ll do that!
13 Views