{"record":{"id":"689ed54020bb45ce","repo":"airbnb/lottie-android","slug":"merge-paths-are-not-supported-pre-kitkat","errorCode":null,"errorMessage":"Merge paths are not supported pre-KitKat.","messagePattern":"Merge paths are not supported pre-KitKat\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"lottie/src/main/java/com/airbnb/lottie/animation/content/MergePathsContent.java","lineNumber":25,"sourceCode":"import com.airbnb.lottie.model.content.MergePaths;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.ListIterator;\n\n@TargetApi(Build.VERSION_CODES.KITKAT)\npublic class MergePathsContent implements PathContent, GreedyContent {\n  private final Path firstPath = new Path();\n  private final Path remainderPath = new Path();\n  private final Path path = new Path();\n\n  private final String name;\n  private final List<PathContent> pathContents = new ArrayList<>();\n  private final MergePaths mergePaths;\n\n  public MergePathsContent(MergePaths mergePaths) {\n    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {\n      throw new IllegalStateException(\"Merge paths are not supported pre-KitKat.\");\n    }\n    name = mergePaths.getName();\n    this.mergePaths = mergePaths;\n  }\n\n  @Override public void absorbContent(ListIterator<Content> contents) {\n    // Fast forward the iterator until after this content.\n    //noinspection StatementWithEmptyBody\n    while (contents.hasPrevious() && contents.previous() != this) {\n    }\n    while (contents.hasPrevious()) {\n      Content content = contents.previous();\n      if (content instanceof PathContent) {\n        pathContents.add((PathContent) content);\n        contents.remove();\n      }\n    }\n  }","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/airbnb/lottie-android/blob/05ea92e90381eb8a8ae06855ea2b74f322bebbec/lottie/src/main/java/com/airbnb/lottie/animation/content/MergePathsContent.java#L7-L43","documentation":"Thrown by MergePathsContent's constructor when Build.VERSION.SDK_INT is below KITKAT (API 19). Merge paths rely on android.graphics.Path#op(Path, Op), which was added in KitKat, so the feature cannot be constructed on older devices.","triggerScenarios":"Loading an animation that contains merge paths (compositing operations exported from After Effects) on a device running Android API < 19; minSdkVersion below 19 with such an animation.","commonSituations":"Shipping to legacy device ranges; an artist adding a merge-path layer to an animation that previously ran on old devices; lowering minSdkVersion without auditing assets.","solutions":["Raise minSdkVersion to 19+ if you can drop pre-KitKat support.","Remove/replace merge-path layers in the After Effects source and re-export for pre-KitKat compatibility.","Gate playback: skip or substitute the animation when Build.VERSION.SDK_INT < KITKAT.","Use LottieCompositionFactory with a failure listener so older devices degrade gracefully."],"exampleFix":"// before\nlottieAnimationView.setAnimation(R.raw.merge_anim);\n\n// after\nif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n  lottieAnimationView.setAnimation(R.raw.merge_anim);\n} else {\n  lottieAnimationView.setAnimation(R.raw.fallback_anim);\n}","handlingStrategy":"validation","validationCode":"boolean canPlayMergePaths = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;\nint res = canPlayMergePaths ? R.raw.merge_anim : R.raw.fallback_anim;\nlottieAnimationView.setAnimation(res);","typeGuard":"boolean supportsMergePaths() {\n  return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;\n}","tryCatchPattern":null,"preventionTips":["Set minSdkVersion to 19+ if you use merge paths.","Provide a fallback animation for pre-KitKat devices.","Audit Lottie assets for merge-path layers before lowering minSdkVersion."],"tags":["api-level","merge-paths","compatibility","path"],"backgroundTag":null,"analyzedSha":"05ea92e90381eb8a8ae06855ea2b74f322bebbec","analyzedAt":"2026-08-14T00:51:35.636Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}