Running Android Emulator on Ubuntu 24.04 — Complete Tutorial

Summary: Step-by-step guide to install Android SDK command-line tools, create an AVD, fix system-image paths, enable KVM, and run the emulator on Ubuntu 24.04.

1. Install Android command-line tools

sudo apt install unzip
mkdir -p ~/Android/cmdline-tools
cd ~/Android
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O cmdline-tools.zip
unzip cmdline-tools.zip
mkdir -p ~/Android/cmdline-tools/latest
mv cmdline-tools/* ~/Android/cmdline-tools/latest/
rm cmdline-tools.zip

2. Set environment variables

Add to ~/.bashrc or ~/.zshrc:

export ANDROID_SDK_ROOT=$HOME/Android/Sdk
export PATH=$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$PATH
source ~/.bashrc

3. Install SDK, emulator, and system image

sdkmanager --update
sdkmanager --licenses
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" "emulator" "system-images;android-34;google_apis;x86_64"

4. Create an AVD

avdmanager create avd -n Pixel_4_API_34 -k "system-images;android-34;google_apis;x86_64" --device "pixel_4"

5. Fix system image path (if you see "Sdk/Sdk" doubled)

If the emulator looks for /home/you/Android/Sdk/Sdk/..., edit the AVD files:

nano ~/.android/avd/Pixel_4_API_34.ini
nano ~/.android/avd/Pixel_4_API_34.avd/config.ini

Replace any /Android/Sdk/Sdk/ occurrences with /Android/Sdk/.

6. Enable virtualization in BIOS

Reboot → enter BIOS → enable:

  • For AMD: SVM Mode
  • For Intel: Intel VT-x

Save and boot into Linux.

7. Load KVM modules and grant user access

sudo modprobe kvm
sudo modprobe kvm_amd   # or `kvm_intel` for Intel
lsmod | grep kvm
sudo usermod -aG kvm $USER
newgrp kvm

8. Run the emulator

emulator -avd Pixel_4_API_34 -gpu swiftshader_indirect

9. Alternative (without KVM)

If KVM cannot be enabled, use an ARM system image:

sdkmanager "system-images;android-34;google_apis;arm64-v8a"
avdmanager create avd -n Pixel_4_API_34_ARM -k "system-images;android-34;google_apis;arm64-v8a" --device "pixel_4"
emulator -avd Pixel_4_API_34_ARM -gpu swiftshader_indirect


  • If you see "Cannot find AVD system path", check ANDROID_SDK_ROOT and ensure system-images exists.
  • If you see "x86_64 emulation currently requires hardware acceleration", KVM isn't active or its modules aren't loaded.
  • Run emulator with -verbose for detailed logs.

0 Comments:

Post a Comment