Rive animation crashes Android x86 emulator
Description
Animations in Flutter Rive causes the Android x86 emulator to crash. Some animations work for a very short period of time, but then it causes the entire emulator to crash with SIGSEGV / error 139.
I reproduced this 100% of the times with multiple versions of the emulator and system images. Easiest is to use your own sample app, but I first found this in our own app.
Steps To Reproduce
Steps to reproduce the behavior:
- Spin up a docker emulator using https://source.android.com/docs/devices/automotive/start/avd/cloud_emulator
- Download Flutter Rive sample from https://github.com/rive-app/rive-flutter/tree/master/example
- flutter pub get && flutter run -d sdk
- click on some animation to render; you may need to go back and then click again once or twice but it will crash in seconds.
Source .riv/.rev file
From sample Flutter Rive.
Device & Versions (please complete the following information)
- Device: Android x86 emulator
- OS: [e.g. Android SDK API Level 30, iOS 14.5]
Tried several, including: │ 50 - 30 R google_apis_playstore (x86_64) │ │ 55 - 31 S google_apis_playstore (x86_64) │ │ 57 - 32 S google_apis_playstore (x86_64) │
│ 1 - EMU canary 33.1.3 │ │ 2 - EMU beta 32.1.10 │ │ 3 - EMU stable 32.1.12
OS: Ubuntu 18.04 and 20.04 with Nested Virtualization enabled.
$ uname -a Linux draco-2 5.4.0-144-generic #161-Ubuntu SMP Fri Feb 3 14:49:04 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux This is a VM on a AMD 5950X but similar issues in Cloud VM using Intel Cascade Lake CPU. Both report kvm working.
$ kvm-ok INFO: /dev/kvm exists KVM acceleration can be used
android-emulator-container-scripts$ id uid=1000(antonio) gid=1000(antonio) groups=1000(antonio),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(kvm),116(lxd),119(libvirt),998(docker)
Also tried GPU software and swiftshader_indirect.
- Flutter Version: Copy-paste the output of
flutter --version
$ flutter --version
Flutter 3.7.5 • channel unknown • unknown source
Framework • revision c07f788888 (5 weeks ago) • 2023-02-22 17:52:33 -0600
Engine • revision 0f359063c4
Tools • Dart 2.19.2 • DevTools 2.20.1
Additional context
Cross posted a bug in Android emulator: https://issuetracker.google.com/issues/275601054
Workaround posted by maintainers of Android emulator: https://issuetracker.google.com/issues/275601054#comment6
TLDR: use -gpu swangle (worked for me) or -gpu host if nvidia GPU is available.
Hi @antonio-arbo, thank you for sharing the above. We can leave this open for now in case anyone else encounters this issue.
Closing this issue as there has been no further reports from other users encountering this.