Android Emulator freezing on Ubuntu
Asked Answered
H

1

5

Installed android studio and emulator versions 31.* or 32.* (latest at the time of this writing) on the following device:

OS: Ubuntu 22.04.2 LTS x86_64 
Kernel: 5.19.0-32-generic 
PC: HP EliteBook 840 G8 Notebook
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] 
CPU: 11th Gen Intel i7-1165G7 (8) @ 4.700GHz.

I checked my CPU for virtualization support: egrep -c '(vmx|svm)' /proc/cpuinfo returns 16 (16 results, so virtualization should be ok), installed KVM stuff:

kvm-ok                                                                                     
INFO: /dev/kvm exists
KVM acceleration can be used

and yet when I run an AVD with hardware graphics (hardware GLES 2.0 enabled), running Google Chrome on the android device freezes the emulator with message: error: kvm run failed Bad address and I'm left with no other option other than force shutting down the emulator.

Heraclitean answered 24/2, 2023 at 16:26 Comment(0)
E
7

I had the same issue when enabling hardware acceleration for android emulator on my machine:

Android Studio Electric Eel | 2022.1.1 Patch 2
Build #AI-221.6008.13.2211.9619390, built on February 17, 2023
Runtime version: 11.0.15+0-b2043.56-8887301 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.15.102-1-manjaro
GC: G1 Young Generation, G1 Old Generation
Memory: 3072M
Cores: 16
Registry:
    external.system.auto.import.disabled=true
    debugger.new.tool.window.layout=true
    ide.text.editor.with.preview.show.floating.toolbar=false
    ide.experimental.ui=true

Non-Bundled Plugins:
    org.intellij.plugins.markdown (221.5787.39)
    IdeaVIM (1.10.3)

Current Desktop: XFCE

There seems to be a problem with the vulkan driver.

Try starting the emulator with the following flag: -feature -Vulkan.

Example:

~/android/sdk/emulator$ ./emulator -avd Pixel_4a_API_33 -feature -Vulkan

If you want to permanently use this arguments when running android studio, set the environment variable studio.emu.params either in your ~/.profile,~/.zprofile,~/.bash_profile with
export studio.emu.params="-feature,-Vulkan" or by adding it to your .desktop entry-file:

~/.local/share/applications/jetbrains-studio.desktop

[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Icon=/opt/intellij/android-studio/bin/studio.svg
# added env variable for disabling qemu-vulkan
Exec=env studio.emu.params="-feature,-Vulkan" "/opt/intellij/android-studio/bin/studio.sh" %f
Comment=The Drive to Develop
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-studio
StartupNotify=true

See:

Eleonoreleonora answered 19/3, 2023 at 16:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.