Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android AnimatedVectorDrawable - Property: is not supported for FullPath

I have this specific error using Android AnimatedVectorDrawableCompat:

Exception: Property: scaleX is not supported for FullPath

  • Using android support lib: 27.0.2
  • Android Nougat SDK

But the same animation is working for older OS versions.

Animation

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="54dp"
        android:height="2dp"
        android:viewportHeight="2.0"
        android:viewportWidth="54.0">

    <!-- Green Line -->
    <path
        android:name="line_green"
        android:pathData="M 0,0 L 54,0 Z"
        android:strokeAlpha="0"
        android:strokeColor="@color/green_color"
        android:strokeWidth="2"/>

</vector>
like image 452
Juan Saravia Avatar asked Aug 10 '18 21:08

Juan Saravia


1 Answers

Since Android Nougat and support lib 27.0.x there are changes in how AnimatedVectorsDrawable works and you need to put your item vectors inside a group and set the "name" to the group and remove it from the path so the animations are applied to the group.

    <!-- Green Line -->
    <group
        android:name="line_green"
        android:strokeAlpha="0">
        <path
            android:pathData="M 0,0 L 54,0 Z"
            android:strokeColor="@color/green_color"
            android:strokeWidth="2"/>
    </group>

I found the solution in this github thread: https://github.com/nickbutcher/plaid/issues/132

like image 97
Juan Saravia Avatar answered Nov 06 '22 07:11

Juan Saravia