Search code examples
androidflutterandroid-emulatorapple-m1

Android emulator randomly crashing on Apple M2 Chip EXC_BAD_ACCESS / KERN_INVALID_ADDRESS


Operating system: Mac OS X
                  13.2.1 22D68
CPU: arm64
     12 CPUs

GPU: UNKNOWN

Crash reason:  EXC_BAD_ACCESS / KERN_INVALID_ADDRESS
Crash address: 0x202922776f646e51
Process uptime: 6125 seconds

Thread 0 (crashed)
 0  libc++.1.dylib + 0x1f40c

Android emulator (not my app) is randomly crashing on M2 chip with the error above, both for flutter apps and native apps.

I tried

  1. Reinstall android studio and emulators.
  2. Give android studio more heap size.
  3. Give emulator more heap size. (It took longer to crash)
  4. Create new emulator.
  5. Cold start emulator.
  6. Use different Android version
  7. Use different config (Ram screen size)
  8. Use different image.

This also has not helped OSX: Android Emulator Crashes

Issue is not happening on other developers using M1 chips, but I am unsure if it is related or not.

Full crash log: https://mclo.gs/7Dx06Ym (It is very long)

I'm using

macOS Ventura 13.2.1 (22D68)
Android Studio Flamingo | 2022.2.1
Build #AI-222.4459.24.2221.9862592, built on March 31, 2023
Runtime version: 17.0.6+0-17.0.6b802.4-9586694 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

Solution

  • Launching and using the emulator inside the android studio, rather than standalone application worked for me.

    Go to Settings -> Preferences -> Emulator -> check "Launch in a tool window". I don't like using the emulator on device manager but will stick with it for now.

    Please comment why this solution works if you know.