If you are running Android Studio on Ubuntu 24.04, you’ve likely encountered the frustrating stutter of the emulator. While KVM is usually the first thing people check, it’s often the deep-system configurations that cause the most friction.
After following below steps, most probably your lags and other performance related issues should be gone.
- Stopping the "Application Not Responding" Dialogs.
GNOME (via the Mutter window manager) periodically checks if an application is responsive. The Android Emulator is a heavy resource hog; sometimes it's so busy processing frames that it misses this "heartbeat" check. When that happens, GNOME might dim the screen or show a "Wait or Force Quit" dialog. Setting this value to 0 disables that check, preventing the desktop environment from interrupting the emulator’s processes.
Execute following command to disable this:
gsettings set org.gnome.mutter check-alive-timeout 0
- Prioritizing Physical RAM (Disabling Swap)
Swap is a space on your hard drive/SSD used when your RAM is full. Because even the fastest NVMe SSD is significantly slower than RAM, "swapping" causes massive lag. Android Emulators require high-speed memory access for their virtualized RAM. By forcing the system to stay within physical RAM, you eliminate the disk-I/O bottleneck that often causes the emulator to freeze for seconds at a time.
Open fstab file:
sudo nano /etc/fstab
Comment out the line starting with /swap.img
#/sawp.img none sw 0 0
- Ensuring Hardware Virtualization
This is your diagnostic baseline. It checks if your CPU’s virtualization features (Intel VT-x or AMD-V) are enabled in the BIOS and if the KVM (Kernel-based Virtual Machine) kernel modules are loaded. Without KVM, the emulator has to use software emulation, which is exponentially slower. Running this ensures that your hardware is actually doing the heavy lifting.
Install kvm:
sudo apt update
sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils cpu-checker
Check if kvm running properly:
kvm-ok
- Expanding File Watch Limits
Android Studio and the underlying build tools (like Gradle) constantly watch thousands of files for changes. Linux has a default limit on how many files a user can "watch" (inotify). When you hit this limit, the IDE and emulator can stutter or fail to sync.
The following command raises that limit to 524,288:
echo "fs.inotify.max_user_watches = 524288" | sudo tee -a /etc/sysctl.d/99-idea.conf
sudo sysctl -p --system
The second command applies that change immediately without needing a reboot.
Top comments (0)