lottie-android
lottie-android copied to clipboard
BaseLayer.applyMasks NullPointerException
- My animation doesn't use any unsupported features.
- I know what part of my animation doesn't work.
- I have created a simplified version of my animation
- I have attached the AEP file (as a zip file so it can be attached) that only has the part of the animation that doesn't work.
Getting Null pointer exception after android version 10 in lottie file in which opacity is used.
I am using 5.0.3 version of Lottie to test this
My app support min SDK 21 and target and compile SDK 32
here is the error log
Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference com.airbnb.lottie.model.layer.BaseLayer.applyMasks (BaseLayer.java:433) com.airbnb.lottie.model.layer.BaseLayer.draw (BaseLayer.java:296) com.airbnb.lottie.model.layer.CompositionLayer.k (CompositionLayer.java:124) com.airbnb.lottie.model.layer.BaseLayer.applySubtractMask (BaseLayer.java:513) com.airbnb.lottie.model.layer.BaseLayer.applyMasks (BaseLayer.java:461) com.airbnb.lottie.model.layer.BaseLayer.draw (BaseLayer.java:296) com.airbnb.lottie.LottieDrawable.g (LottieDrawable.java:59) com.airbnb.lottie.LottieDrawable.draw (LottieDrawable.java:34)
Which indicated the error in this line BaseKeyframeAnimation<Integer, Integer> opacityAnimation = this.mask.getOpacityAnimations().get(i); in applyMasks Method of BaseLayer class
Does this happen 100% of the time or only sometimes? Can you attach your animation or a sample project? Was your animation exported with Bodymovin for After Effects or something else?
Does this happen 100% of the time or only sometimes? Can you attach your animation or a sample project? Was your animation exported with Bodymovin for After Effects or something else?
Yes, this happens 100% of the time. Due to NDA, I can't upload the animation.
Without a repro animation, I won't be able to fix this. Are your designers using After Effects? If so, can you work with them to create a repro animation (preferable with the aep file) that crashes but uses simple shapes like square or something?
Here is more detail about the crash - device, and os. Attached the screenshots
@Mihir3646 I thought you said it happened 100% of the time. If that's true then OS/device metrics aren't important. Without a repro, I won't be able to help here, however.
@Mihir3646 I thought you said it happened 100% of the time. If that's true then OS/device metrics aren't important. Without a repro, I won't be able to help here, however.
I will post that in a couple of days, that needs to be extracted with the help of my designing team.
Unfortunately, without a repro, it won't be possible to assist you here. This is the compiled bytecode -> decompiled java for that line
for(int i = 0; i < this.mask.getMasks().size(); ++i) {
Mask mask = (Mask)this.mask.getMasks().get(i);
BaseKeyframeAnimation<ShapeData, Path> maskAnimation = (BaseKeyframeAnimation)this.mask.getMaskAnimations().get(i);
BaseKeyframeAnimation<Integer, Integer> opacityAnimation = (BaseKeyframeAnimation)this.mask.getOpacityAnimations().get(i); // <-- This line
It isn't clear to me where there is an Integer
that gets boxed to an int
.
If you can attach a repro, I'd be happy to assist though.