Baseflow / LottieXamarin

Render After Effects animations natively on Android, iOS, MacOS and TvOS for Xamarin
https://baseflow.com
Apache License 2.0
1.21k stars 261 forks source link

Animation stopped working on Android #383

Open tomh4 opened 2 years ago

tomh4 commented 2 years ago

🔙 Regression

We had animations loading on Android and iOS, and somehow (maybe with Android 12? Not sure!) They stopped working on Android, but still work on iOS.

Old (and correct) behavior

Displaying the animation on both platforms

Current behavior

Crashing on Android

Java.Lang.NullPointerException: Attempt to invoke virtual method 'com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation com.airbnb.lottie.model.animatable.AnimatableFloatValue.createAnimation()' on a null object reference
  at java.lang.NullPointerException: Attempt to invoke virtual method 'com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation com.airbnb.lottie.model.animatable.AnimatableFloatValue.createAnimation()' on a null object reference
  at at com.airbnb.lottie.animation.content.TrimPathContent.<init>(TrimPathContent.java:24)
  at at com.airbnb.lottie.model.content.ShapeTrimPath.toContent(ShapeTrimPath.java:69)
  at at com.airbnb.lottie.animation.content.ContentGroup.contentsFromModels(ContentGroup.java:37)
  at at com.airbnb.lottie.animation.content.ContentGroup.<init>(ContentGroup.java:68)
  at at com.airbnb.lottie.model.layer.ShapeLayer.<init>(ShapeLayer.java:26)
  at at com.airbnb.lottie.model.layer.BaseLayer.forModel(BaseLayer.java:55)
  at at com.airbnb.lottie.model.layer.CompositionLayer.<init>(CompositionLayer.java:56)
  at at com.airbnb.lottie.LottieDrawable.buildCompositionLayer(LottieDrawable.java:322)
  at at com.airbnb.lottie.LottieDrawable.setComposition(LottieDrawable.java:221)
  at at com.airbnb.lottie.LottieAnimationView.setComposition(LottieAnimationView.java:586)
  at at com.airbnb.lottie.LottieAnimationView$2.onResult(LottieAnimationView.java:85)
  at at com.airbnb.lottie.LottieAnimationView$2.onResult(LottieAnimationView.java:83)
  at at com.airbnb.lottie.LottieTask.notifySuccessListeners(LottieTask.java:148)
  at at com.airbnb.lottie.LottieTask.access$100(LottieTask.java:28)
  at at com.airbnb.lottie.LottieTask$1.run(LottieTask.java:135)
  at at android.os.Handler.handleCallback(Handler.java:938)
  at at android.os.Handler.dispatchMessage(Handler.java:99)
  at at android.os.Looper.loop(Looper.java:223)
  at at android.app.ActivityThread.main(ActivityThread.java:7656)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Reproduction steps

Load the attached animation on Xamarin.Forms deployed to Android

Configuration

Version: 4.1.0

Platform:

tomh4 commented 2 years ago

anim.txt

deelw commented 2 years ago

I have the same problem..

deelw commented 2 years ago

@tomh4 I added Com.Airbnb.Android.Lottie to my Android project and now it works like a charm!