Android上的Lottie动画奇怪错误,可在iOS上使用。路径无法自行循环

有人为我制作了这个Lottie动画:https://lottiefiles.com/share/DO3Kpo

它似乎可以在iOS上完美运行,但是在Android上会引发以下异常。我们做了很多尝试,但无法弄清楚问题可能出在哪里。有人对此有何想法?

Java.Lang.IllegalStateException: Unable to parse composition ---> Java.Lang.IllegalArgumentException: The Path cannot loop back on itself.
  at java.lang.IllegalArgumentException: The Path cannot loop back on itself.
  at at android.view.animation.PathInterpolator.initPath(PathInterpolator.java:185)
  at at android.view.animation.PathInterpolator.initCubic(PathInterpolator.java:158)
  at at android.view.animation.PathInterpolator.<init>(PathInterpolator.java:89)
  at at android.support.v4.view.animation.PathInterpolatorCompat.create(PathInterpolatorCompat.java:82)
  at at com.airbnb.lottie.parser.KeyframeParser.parseKeyframe(KeyframeParser.java:130)
  at at com.airbnb.lottie.parser.KeyframeParser.parse(KeyframeParser.java:58)
  at at com.airbnb.lottie.parser.PathKeyframeParser.parse(PathKeyframeParser.java:21)
  at at com.airbnb.lottie.parser.AnimatablePathValueParser.parse(AnimatablePathValueParser.java:29)
  at at com.airbnb.lottie.parser.AnimatablePathValueParser.parseSplitPath(AnimatablePathValueParser.java:55)
  at at com.airbnb.lottie.parser.AnimatableTransformParser.parse(AnimatableTransformParser.java:54)
  at at com.airbnb.lottie.parser.LayerParser.parse(LayerParser.java:99)
  at at com.airbnb.lottie.parser.LottieCompositionParser.parseAssets(LottieCompositionParser.java:147)
  at at com.airbnb.lottie.parser.LottieCompositionParser.parse(LottieCompositionParser.java:77)
  at at com.airbnb.lottie.LottieCompositionFactory.fromJsonReaderSyncInternal(LottieCompositionFactory.java:248)
  at at com.airbnb.lottie.LottieCompositionFactory.fromJsonReaderSync(LottieCompositionFactory.java:242)
  at at com.airbnb.lottie.LottieCompositionFactory.fromJsonInputStreamSync(LottieCompositionFactory.java:177)
  at at com.airbnb.lottie.LottieCompositionFactory.fromJsonInputStreamSync(LottieCompositionFactory.java:171)
  at at com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(LottieCompositionFactory.java:114)
  at at com.airbnb.lottie.LottieCompositionFactory$2.call(LottieCompositionFactory.java:95)
  at at com.airbnb.lottie.LottieCompositionFactory$2.call(LottieCompositionFactory.java:93)
  at at java.util.concurrent.Futuretask.run(Futuretask.java:266)
  at at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
  at at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
  at at java.lang.Thread.run(Thread.java:764)
stkelvinlee 回答:Android上的Lottie动画奇怪错误,可在iOS上使用。路径无法自行循环

我认为您可以在https://github.com/airbnb/lottie-android/issues

提出问题

共享指向json的链接,他们可能会调查此问题。

我可以在这里复制它。这仅在Android上发生是因为Exception在Android类中发生:

// Note the class path: android.view.animation.PathInterpolator
at at android.view.animation.PathInterpolator.initPath(PathInterpolator.java:185)
at at android.view.animation.PathInterpolator.initCubic(PathInterpolator.java:158)
at at android.view.animation.PathInterpolator.<init>(PathInterpolator.java:89)
at at android.support.v4.view.animation.PathInterpolatorCompat.create(PathInterpolatorCompat.java:82)
at at com.airbnb.lottie.parser.KeyframeParser.parseKeyframe(KeyframeParser.java:130)

检查PathInterpolator的源代码:

float fraction = pointComponents[componentIndex++];
float x = pointComponents[componentIndex++];
float y = pointComponents[componentIndex++];
if (fraction == prevFraction && x != prevX) {
    throw new IllegalArgumentException(
            "The Path cannot have discontinuity in the X axis.");
}
if (x < prevX) {
    // Exception is being triggered here due to x < prevX
    throw new IllegalArgumentException("The Path cannot loop back on itself.");
}

PathInterpolator正在被Lottie库调用。因此,他们可能会在此问题上提供更好的反馈。

尝试:https://github.com/airbnb/lottie-android/issues

请注意,他们需要AEP文件。因此,请与您的朋友联系以获取该文件:

  

压缩After Effects AEP文件并将其附加。如果您的问题没有AEP或没有其他明确的原因,则会自动关闭。

,

调试后,我发现了问题所在。在那里,两个具有相同名称的图层导致冲突。不知道这是否是Lottie for Android中的错误,初始版本是否可以在iOS上正常运行。因此,请确保每个图层的名称都不同;-)

本文链接:https://www.f2er.com/3011490.html

大家都在问