Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRASH: Fatal Exception: java.lang.IllegalStateException: Underflow in restore - more restores than saves #2609

Open
arcao opened this issue Feb 11, 2025 · 0 comments

Comments

@arcao
Copy link

arcao commented Feb 11, 2025

Deps:

  • com.airbnb.android:lottie:6.6.2

Device Model:

  • Pixel 3a XL (Android 12)

App sometime crash in animation to the destination fragment where lottie is inside layout. The fragment is newer shown and it crash during lottie rendering. These crashes started after updating Lottie from version 6.5.0 to 6.6.2. Before there was no crashes.

Fatal Exception: java.lang.IllegalStateException: Underflow in restore - more restores than saves
       at android.graphics.Canvas.restore(Canvas.java:647)
       at com.airbnb.lottie.model.layer.ImageLayer.drawLayer(ImageLayer.java:100)
       at com.airbnb.lottie.model.layer.BaseLayer.draw(BaseLayer.java:270)
       at com.airbnb.lottie.model.layer.CompositionLayer.drawLayer(CompositionLayer.java:161)
       at com.airbnb.lottie.model.layer.BaseLayer.draw(BaseLayer.java:270)
       at com.airbnb.lottie.LottieDrawable.drawDirectlyToCanvas(LottieDrawable.java:1751)
       at com.airbnb.lottie.LottieDrawable.draw(LottieDrawable.java:758)
       at android.widget.ImageView.onDraw(ImageView.java:1442)
       at android.view.View.draw(View.java:22704)
       at android.view.View.updateDisplayListIfDirty(View.java:21579)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:2082)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.draw(View.java:22707)
       at android.view.View.updateDisplayListIfDirty(View.java:21579)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at androidx.fragment.app.FragmentContainerView.drawChild(FragmentContainerView.kt:232)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at androidx.fragment.app.FragmentContainerView.dispatchDraw(FragmentContainerView.kt:222)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at androidx.fragment.app.FragmentContainerView.drawChild(FragmentContainerView.kt:232)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at androidx.fragment.app.FragmentContainerView.dispatchDraw(FragmentContainerView.kt:222)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:2082)
       at android.view.View.draw(View.java:22707)
       at android.view.View.updateDisplayListIfDirty(View.java:21579)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1277)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.updateDisplayListIfDirty(View.java:21570)
       at android.view.View.draw(View.java:22435)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
       at android.view.View.draw(View.java:22707)
       at com.android.internal.policy.DecorView.draw(DecorView.java:819)
       at android.view.View.updateDisplayListIfDirty(View.java:21579)
       at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:534)
       at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:540)
       at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:616)
       at android.view.ViewRootImpl.draw(ViewRootImpl.java:4525)
       at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4245)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3374)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2179)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8787)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
       at android.view.Choreographer.doCallbacks(Choreographer.java:845)
       at android.view.Choreographer.doFrame(Choreographer.java:780)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7870)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Lottie used like:

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.airbnb.lottie.LottieAnimationView
        android:id="@+id/image"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/layout_margin"
        android:contentDescription="@null"
        app:layout_constraintBottom_toTopOf="@+id/title"
        app:layout_constraintDimensionRatio="1:1"
        app:layout_constraintHeight_max="300dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintVertical_bias="0.33"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_chainStyle="packed"
        app:layout_constraintWidth_max="300dp"
        app:lottie_autoPlay="true"
        app:lottie_rawRes="@raw/anim_email_verification"
        tools:lottie_rawRes="@null" />

        ...
</androidx.constraintlayout.widget.ConstraintLayout>

Lottie files:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant