airbnb/lottie-android · error · UnsupportedOperationException

Cannot call getKeyframes on AnimatableSplitDimensionPathValu

Error message

Cannot call getKeyframes on AnimatableSplitDimensionPathValue.

What it means

AnimatableSplitDimensionPathValue implements the AnimatableValue<PointF, PointF> interface, which declares getKeyframes(), but this implementation derives its PointF by merging two independent AnimatableFloatValue tracks (one for X, one for Y) via SplitDimensionPathKeyframeAnimation. It has no keyframe list of its own, so calling getKeyframes() is an intentional contract violation that throws UnsupportedOperationException. The library never calls this method internally on this type; it only arises when application code treats all AnimatableValue instances polymorphically and calls getKeyframes() generically.

Source

Thrown at lottie/src/main/java/com/airbnb/lottie/model/animatable/AnimatableSplitDimensionPathValue.java:24

import com.airbnb.lottie.animation.keyframe.SplitDimensionPathKeyframeAnimation;
import com.airbnb.lottie.value.Keyframe;

import java.util.List;

public class AnimatableSplitDimensionPathValue implements AnimatableValue<PointF, PointF> {
  private final AnimatableFloatValue animatableXDimension;
  private final AnimatableFloatValue animatableYDimension;

  public AnimatableSplitDimensionPathValue(
      AnimatableFloatValue animatableXDimension,
      AnimatableFloatValue animatableYDimension) {
    this.animatableXDimension = animatableXDimension;
    this.animatableYDimension = animatableYDimension;
  }

  @Override
  public List<Keyframe<PointF>> getKeyframes() {
    throw new UnsupportedOperationException("Cannot call getKeyframes on AnimatableSplitDimensionPathValue.");
  }

  @Override
  public boolean isStatic() {
    return animatableXDimension.isStatic() && animatableYDimension.isStatic();
  }

  @Override public BaseKeyframeAnimation<PointF, PointF> createAnimation() {
    return new SplitDimensionPathKeyframeAnimation(
        animatableXDimension.createAnimation(), animatableYDimension.createAnimation());
  }
}

View on GitHub (pinned to 05ea92e903)

Solutions

  1. Guard with instanceof: check `if (animatableValue instanceof AnimatableSplitDimensionPathValue)` before calling getKeyframes(), and skip or handle it separately.
  2. Call isStatic() or createAnimation() instead — both are fully supported on this type and provide the information you likely need.
  3. If you need the underlying keyframes, access them via getAnimatableXDimension().getKeyframes() and getAnimatableYDimension().getKeyframes() (requires extending the class or adding accessors).

Example fix

// before
for (AnimatableValue<PointF, PointF> v : animatableValues) {
    List<Keyframe<PointF>> keys = v.getKeyframes(); // throws on split-dimension
    process(keys);
}

// after
for (AnimatableValue<PointF, PointF> v : animatableValues) {
    if (v instanceof AnimatableSplitDimensionPathValue) {
        continue; // no unified keyframes; use createAnimation() instead
    }
    List<Keyframe<PointF>> keys = v.getKeyframes();
    process(keys);
}
Defensive patterns

Strategy: type-guard

Type guard

// Type guard before calling getKeyframes()
public static boolean hasKeyframes(AnimatableValue<?, ?> value) {
    return !(value instanceof AnimatableSplitDimensionPathValue);
}

Prevention

When it happens

Trigger: Calling .getKeyframes() on an AnimatableValue that is actually an AnimatableSplitDimensionPathValue instance — typically through a generic loop or utility that processes any AnimatableValue<PointF, PointF> without instanceof checks. Also triggered by reflection-based code or serialization frameworks that invoke all interface methods.

Common situations: Writing generic keyframe-inspection tooling that iterates over all animatable properties in a LottieComposition; building a Lottie animation validator/debugger; migrating from a code path that previously only encountered AnimatablePathValue (which does support getKeyframes) to one that now also encounters split-dimension anchor points.

Related errors


AI-assisted analysis of airbnb/lottie-android@05ea92e903 (2026-08-14). Data as JSON: /api/errors/d9491b92ed956aff. Report an issue: GitHub.