question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Weird crash when showing a Lottie animation : "Invalid Layer Save Flag"

See original GitHub issue

Tested on Pixel 2 with Android P DP3. I tried to disable hardware acceleration. Didn’t help. Version 2.5.5 of the library, but also on 2.5.4 (updated because I was hoping it will fix it). Doesn’t seem to occur on older Android versions. Also, file can be shown just fine via the sample Lottie app from the Play Store. I see some logs of this sort, before the crash.

E/AbstractTracker: Can’t create handler inside thread that has not called Looper.prepare()

But I can’t find out where this occurs, and can’t see which class cause it.

I’ve also noticed that another animation of Lottie also causes this crash, but another doesn’t.

This is how we use it:

<...LottieAnimationViewEx
    android:layout_width="@dimen/please_wait_big__animation_size" android:layout_height="@dimen/please_wait_big__animation_size" app:lottie_autoPlay="true"
    app:lottie_loop="true" app:lottie_rawRes="@raw/please_wait_big"
    tools:src="@android:drawable/sym_def_app_icon"/>

And this is the code of the LottieAnimationViewEx class:

class LottieAnimationViewEx @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : LottieAnimationView(context, attrs, defStyleAttr) {

    init{
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            useHardwareAcceleration(true)
    }

}

This is what I get in logs :

2018-06-11 10:17:25.666 27443-27443/… E/AndroidRuntime: FATAL EXCEPTION: main Process: …, PID: 27443 java.lang.IllegalArgumentException: Invalid Layer Save Flag - only ALL_SAVE_FLAGS is allowed at android.graphics.Canvas.checkValidSaveFlags(Canvas.java:378) at android.graphics.Canvas.saveLayer(Canvas.java:455) at com.airbnb.lottie.model.layer.BaseLayer.draw(BaseLayer.java:224) at com.airbnb.lottie.model.layer.CompositionLayer.drawLayer(CompositionLayer.java:100) at com.airbnb.lottie.model.layer.BaseLayer.draw(BaseLayer.java:190) at com.airbnb.lottie.LottieDrawable.draw(LottieDrawable.java:312) at android.widget.ImageView.onDraw(ImageView.java:1360) at android.view.View.draw(View.java:20205) at android.view.View.updateDisplayListIfDirty(View.java:19080) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20208) at android.view.View.updateDisplayListIfDirty(View.java:19080) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19071) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.updateDisplayListIfDirty(View.java:19071) at android.view.View.draw(View.java:19933) at android.view.ViewGroup.drawChild(ViewGroup.java:4333) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112) at android.view.View.draw(View.java:20208) at com.android.internal.policy.DecorView.draw(DecorView.java:780) at android.view.View.updateDisplayListIfDirty(View.java:19080) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:685) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:691) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:799) at android.view.ViewRootImpl.draw(ViewRootImpl.java:3263) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3079) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2459) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1447) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7130) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:935) at android.view.Choreographer.doCallbacks(Choreographer.java:747) at android.view.Choreographer.doFrame(Choreographer.java:682) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:921) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6642) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

I wanted to create a new POC with this issue, and publish here, but then I got this weird error, just by adding the dependency of Lottie :

image

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\0.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\1.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\2.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\3.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\4.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\5.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\6.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\7.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\8.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\9.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\10.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\11.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\12.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\13.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\14.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\15.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\16.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\18.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\19.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\21.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\23.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\24.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\25.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\26.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\27.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\28.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\29.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\30.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\31.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\32.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\33.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\34.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\35.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\36.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\37.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\38.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\39.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\40.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\41.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\42.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\43.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\44.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\45.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\46.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\48.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\49.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\50.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\51.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\52.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\53.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\54.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\55.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\56.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\57.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\58.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\59.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\61.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\62.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\63.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\64.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\65.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\66.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\67.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\68.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\69.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\70.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\71.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\72.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\73.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\74.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\75.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\76.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\77.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\78.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\79.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\80.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\81.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\82.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\83.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\84.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\85.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\86.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\87.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\88.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\89.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\90.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\91.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\92.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\93.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\94.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\95.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\96.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\97.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\98.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\99.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\100.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\101.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\102.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\103.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\104.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\105.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\106.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\107.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\108.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\109.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\110.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\111.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\113.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\114.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\115.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\117.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\118.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\119.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\120.jar, C:\Users\User\AndroidStudioProjects\MyApplication7\app\build\intermediates\transforms\dexBuilder\debug\121.jar

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

What’s going on?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:35

github_iconTop GitHub Comments

8reactions
GuilhEcommented, Oct 1, 2018

implementation 'com.airbnb.android:lottie:2.7.0' fixes the issue

4reactions
eric-labellecommented, Jul 26, 2018

Yeah, 2.5.7 seemed to be broken for me too, and had nothing more than 2.5.6 so I did take 2.5.6 too to fix the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting problems with Lottie Animations - YouTube
Hi everyone. If you're not a hardcore animator but you've been dabbling in After Effects and Lottie, to give your Webflow sites some...
Read more >
NoesisGUI Issue Tracker
https://www.noesisengine.com/bugs/file_download.php?file_id=1715&type=bug ... 2022-11-07 16:05, Strangely, I am seeing incorrect images/textures shown.
Read more >
Fixed issues in After Effects - Adobe Support
Fixed an issue that caused After Effects to become unresponsive and eventually crash when invalid characters are entered in the Timeline ...
Read more >
[안드로이드] Lottie 애니메이션 에러java.lang ...
Bug: Weird crash when showing a Lottie animation : "Invalid Layer Save Flag" · Issue #802 · airbnb/lottie-android.
Read more >
Platform/GFX/perf triage - MozillaWiki
Platform/GFX/perf triage. < Platform‎ | GFX. The page contains a breakdown of performance related bugs and tasks for WebRender. See also ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found