Aghajari / AXrLottie

AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)
Apache License 2.0
147 stars 26 forks source link

Crash when constructing AXrLottieDrawable #16

Closed fourlastor closed 3 years ago

fourlastor commented 3 years ago

Hello, I'm seeing a crash (from analytics, I haven't been able to reproduce it myself yet) when initializing an AXrLottieDrawable:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Handler.post(java.lang.Runnable)' on a null object reference
       at com.aghajari.rlottie.DispatchQueue.postRunnable(DispatchQueue.java:91)
       at com.aghajari.rlottie.DispatchQueue.postRunnable(DispatchQueue.java:81)
       at com.aghajari.rlottie.DispatchQueuePool.execute(DispatchQueuePool.java:94)
       at com.aghajari.rlottie.AXrLottieDrawable.scheduleNextGetFrame(AXrLottieDrawable.java:849)
       at com.aghajari.rlottie.AXrLottieDrawable.setAllowDecodeSingleFrame(AXrLottieDrawable.java:689)
       at com.aghajari.rlottie.AXrLottieDrawable.initFromJson(AXrLottieDrawable.java:491)
       at com.aghajari.rlottie.AXrLottieDrawable.<init>(AXrLottieDrawable.java:438)
       at com.aghajari.rlottie.AXrLottieDrawable$Builder.build(AXrLottieDrawable.java:1329)

After a bit of investigation, this seems to happen at this line of DispatchQueue.

I think the source of the NPE could be in the try/catch statement a few lines before, my guess is that syncLatch.await(); throws an InterruptedException before being released, which would lead to handler being null.

Aghajari commented 3 years ago

Hi @fourlastor , Check out v1.3.0

fourlastor commented 3 years ago

Hi! Thank you :) I'm going to have enough data on whether this fixed the initial bug or not in a couple weeks, I'll keep you posted!

fourlastor commented 3 years ago

Hi @Aghajari!

I'm getting a new crash with 1.3.1:

Caused by java.lang.UnsatisfiedLinkError: No implementation found for long com.aghajari.rlottie.AXrLottieNative.createWithJson(java.lang.String, java.lang.String, int[]) (tried Java_com_aghajari_rlottie_AXrLottieNative_createWithJson and Java_com_aghajari_rlottie_AXrLottieNative_createWithJson__Ljava_lang_String_2Ljava_lang_String_2_3I)
       at com.aghajari.rlottie.AXrLottieNative.createWithJson(AXrLottieNative.java)
       at com.aghajari.rlottie.AXrLottieDrawable.initFromJson(AXrLottieDrawable.java:491)
       at com.aghajari.rlottie.AXrLottieDrawable.<init>(AXrLottieDrawable.java:441)
       at com.aghajari.rlottie.AXrLottieDrawable$Builder.build(AXrLottieDrawable.java:1332)

It looks like it's not managing to load the library at runtime, but it doesn't crash, so it crashes whenever I use the animation view. Maybe something similar to Rive's approach might work?

Another approach I found looking things up is relinker