airbnb/lottie-android · error · UnsupportedOperationException

LottieAnimator does not support setInterpolator.

Error message

LottieAnimator does not support setInterpolator.

What it means

BaseLottieAnimator overrides ValueAnimator.setInterpolator(TimeInterpolator) to unconditionally throw UnsupportedOperationException. Lottie animations have per-keyframe interpolators defined in the composition JSON (e.g., Bezier easing curves exported from After Effects). Setting a global interpolator would conflict with these per-property interpolators, so the method is disabled.

Source

Thrown at lottie/src/main/java/com/airbnb/lottie/utils/BaseLottieAnimator.java:30

  private final Set<ValueAnimator.AnimatorUpdateListener> updateListeners = new CopyOnWriteArraySet<>();
  private final Set<AnimatorListener> listeners = new CopyOnWriteArraySet<>();
  private final Set<Animator.AnimatorPauseListener> pauseListeners = new CopyOnWriteArraySet<>();


  @Override public long getStartDelay() {
    throw new UnsupportedOperationException("LottieAnimator does not support getStartDelay.");
  }

  @Override public void setStartDelay(long startDelay) {
    throw new UnsupportedOperationException("LottieAnimator does not support setStartDelay.");
  }

  @Override public ValueAnimator setDuration(long duration) {
    throw new UnsupportedOperationException("LottieAnimator does not support setDuration.");
  }

  @Override public void setInterpolator(TimeInterpolator value) {
    throw new UnsupportedOperationException("LottieAnimator does not support setInterpolator.");
  }

  public void addUpdateListener(ValueAnimator.AnimatorUpdateListener listener) {
    updateListeners.add(listener);
  }

  public void removeUpdateListener(ValueAnimator.AnimatorUpdateListener listener) {
    updateListeners.remove(listener);
  }

  public void removeAllUpdateListeners() {
    updateListeners.clear();
  }

  public void addListener(Animator.AnimatorListener listener) {
    listeners.add(listener);
  }

View on GitHub (pinned to 05ea92e903)

Solutions

  1. Remove the setInterpolator() call — Lottie interpolators come from the composition's keyframe data and cannot be overridden globally
  2. If you need custom easing for specific properties, set interpolators on individual LottieValueCallback or use LottieProperty key-value overrides
  3. To adjust overall timing feel, use setSpeed() or setMinAndMaxFrame() rather than an interpolator

Example fix

// before: animator.setInterpolator(new DecelerateInterpolator());
// after:  // Lottie interpolators come from the After Effects keyframe data.
//         // Remove the setInterpolator call.
//         // To customize easing for specific properties, use a value callback:
//         lottieAnimationView.addValueCallback(
//             new KeyPath("Shape", "Transform", "Opacity"),
//             LottieProperty.OPACITY,
//             new LottieValueCallback<>(50));
Defensive patterns

Strategy: type-guard

Type guard

// Guard against calling setInterpolator on LottieAnimator
boolean isLottieAnimator(ValueAnimator animator) {
  return animator instanceof com.airbnb.lottie.utils.BaseLottieAnimator;
}

// Safe access:
void safeSetInterpolator(ValueAnimator animator, TimeInterpolator interpolator) {
  if (animator instanceof com.airbnb.lottie.utils.BaseLottieAnimator) {
    return; // skip: Lottie uses keyframe interpolators from the composition
  }
  animator.setInterpolator(interpolator);
}

Prevention

When it happens

Trigger: Calling setInterpolator(interpolator) on a LottieValueAnimator or LottieAnimationView. This can happen directly, or through animation utility code that applies a default interpolator (e.g., DecelerateInterpolator) to all animators. The throw is at BaseLottieAnimator.java:30.

Common situations: A developer applies a standard Android interpolator (LinearInterpolator, AccelerateDecelerateInterpolator) expecting it to affect Lottie playback. Code that sets interpolators on all ValueAnimators generically. Migration from standard animation code. Using a shared animation configuration that includes an interpolator.

Related errors


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