BottomSheetFragment 上的 Lottie 动画崩溃

发布于 2025-01-16 02:58:00 字数 997 浏览 2 评论 0原文

我有一个具有以下视图的 BottomSheetDialogFragment:

<com.airbnb.lottie.LottieAnimationView
            android:id="@+id/myAnimation"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:contentDescription="@null"
            app:layout_constraintBottom_toTopOf="@id/title"
            app:layout_constraintStart_toStartOf="@id/image"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintEnd_toEndOf="@id/image"
            app:lottie_autoPlay="true"
            app:lottie_loop="true"
            app:lottie_rawRes="@raw/lottie_animation"
            tools:src="@raw/lottie_animation" />

当我打开 BottomSheet 并旋转它几次时,经过几次旋转,它会因以下错误而崩溃:

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 16124 (PixelCopy)

如果我在片段上运行,它不会崩溃。 如果我在不同的(干净的)示例应用程序上进行测试,它不会以任何方式崩溃。

使用不同(可能更轻)的乐蒂动画的其他底部工作表不会崩溃。

我想知道如何找到导致崩溃的原因。

谢谢。

I've a BottomSheetDialogFragment with the following view:

<com.airbnb.lottie.LottieAnimationView
            android:id="@+id/myAnimation"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:contentDescription="@null"
            app:layout_constraintBottom_toTopOf="@id/title"
            app:layout_constraintStart_toStartOf="@id/image"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintEnd_toEndOf="@id/image"
            app:lottie_autoPlay="true"
            app:lottie_loop="true"
            app:lottie_rawRes="@raw/lottie_animation"
            tools:src="@raw/lottie_animation" />

When I open my bottomSheet and rotate it few times, after few rotations, it crashes with this error:

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 16124 (PixelCopy)

It doesn't crash if I run in on a Fragment.
It doesn't crash in any way if i test in on a different (clean) sample app.

Other bottom sheets that use different (maybe lighter) lottie animations don't crash.

I wonder how can I find what makes it to crash.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

春风十里 2025-01-23 02:58:01

欢迎来到 SIGSEGV 错误,我的朋友

Welcome to SIGSEGV error, my friend????.
So SIGSEGV error is caused when a program tries to access a memory location outside the allocated memory.

Recently I have also started adding Lottie animations on my Android app and it crashes in slightly lower end devices after a few seconds with this error: Could not allocate X bytes.[In place of X, there's a big number shown in the logs]

So the solution is

  1. Either try to find a lighter Lottie animation
  2. Or try to generate a GIF out of the Lottie and then reduce the number of frames using some photo editing tool

If you don't do this, then your app will eat up a lot of RAM even if it doesn't crash.

Regards,
Debayan

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文