whoami

Lucas Jenß

cat /etc/motd

The Coding Journal ツ — Notes taken on an epic coding journey. Technical solutions, debugging notes, and practical guides from the trenches of software development.

Close-up of white dominoes with black dots standing on green felt surface, shallow depth of field, focused mood

ls -la ~/languages/

total 8
drwxr-xr-x
▶ PHP
▶ Ruby
▶ Scala
▶ C#
▶ JavaScript
▶ Objective-C
▶ Shell Scripting

ls -la ~/toolchain/

total 7
drwxr-xr-x
▶ Typo3
▶ Akka
▶ Capistrano
▶ Git
▶ MAMP
▶ Adobe Illustrator
▶ NSTrackingArea (Cocoa)

uname -a

platforms
drwxr-xr-x
▶ Mac OS X
▶ Unix

Setting Up A Hardware-Accelerated Android Emulator on Linux

A local Android virtual device is useful when a physical handset is unavailable, inconvenient, or needed for repeatable testing. On Linux, the Android Emulator can run much faster when it uses the host processor’s virtualisation extensions and the system’s graphics stack instead of software-only emulation.

The main pieces are Android Studio or the command-line SDK tools, an installed system image, KVM support, and a working OpenGL or Vulkan path. The setup is generally straightforward, but permissions, firmware settings, and graphics drivers can make the difference between a smooth emulator and a sluggish window.

This guide focuses on current Linux desktops, including Ubuntu-based distributions commonly used by developers in Sydney, Melbourne, Brisbane, and other Australian cities. The commands may need small changes on Fedora, Arch, or a corporate workstation with stricter security policies.

A fast emulator also makes automated testing more practical. It can run alongside PHP, Java, or backend development tools without forcing every test onto a shared device. Notes from this kind of setup fit naturally beside other troubleshooting references, including the PHP development notes.

Check Virtualisation Support First

Hardware acceleration depends on a processor feature exposed by the computer firmware. Intel systems usually call it VT-x or Intel Virtualisation Technology, while AMD systems use AMD-V or SVM. Enter the UEFI setup during startup and enable the relevant option if it is disabled. The exact menu varies between a Dell laptop, a custom desktop, and a business machine supplied by an Australian employer.

Linux can confirm whether the CPU advertises virtualisation instructions. Install cpu-checker on Debian or Ubuntu, then run:

sudo apt update
sudo apt install cpu-checker
kvm-ok

A successful result normally reports that /dev/kvm exists and that KVM acceleration can be used. You can also inspect the processor flags:

grep -Eoc '(vmx|svm)' /proc/cpuinfo

A value greater than zero is encouraging, although it does not prove that firmware or permissions are correctly configured.

KVM means Kernel-based Virtual Machine. The Android Emulator uses it to execute much of the guest CPU workload close to native speed. If another virtualisation product has claimed exclusive access, or if the computer itself is running inside a virtual machine, KVM may be unavailable. Nested virtualisation must be enabled by the outer hypervisor in that situation.

Install KVM And Correct Permissions

On Ubuntu and other Debian-based distributions, install the common KVM components with:

sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils

The Android Emulator does not require a full libvirt workflow, but these packages provide the kernel and management tools normally expected on a desktop development machine. Confirm that the device node is present:

ls -l /dev/kvm

Your user account generally needs membership of the kvm group. Add it, and optionally add the libvirt group if you use virtual machines for other work:

sudo usermod -aG kvm,libvirt "$USER"

Log out and back in, or reboot, before testing again. A new terminal opened immediately after the command may still use the old group membership. Check the active groups with:

groups

Avoid solving a permission error by making /dev/kvm world-writable. That workaround is insecure and will often disappear after a reboot or package update. If the device is missing entirely, inspect the kernel modules and recent messages:

lsmod | grep kvm
dmesg | grep -i kvm

Some distributions load kvm_intel or kvm_amd automatically. A locked-down work computer may also apply policies that prevent access, so an administrator may need to adjust the configuration.

Install The Android SDK And Emulator

Android Studio is the simplest route for most developers. During installation, include Android SDK, Android SDK Platform-Tools, Android Emulator, and at least one SDK platform. In SDK Manager, select a system image matching the Android version and CPU architecture you intend to test.

The command-line tools are useful on a lightweight workstation or a build server. Once the SDK environment variables point to the correct directory, list available packages:

sdkmanager --list

Install the emulator and an example x86_64 image:

sdkmanager "platform-tools" "emulator" \
  "platforms;android-35" \
  "system-images;android-35;google_apis;x86_64"

The package name changes as Android releases evolve. Use an image appropriate for the application rather than installing every available API level. An x86_64 image is normally the practical choice on an Intel or AMD Linux host because it avoids translating ARM instructions.

Create an Android Virtual Device through Device Manager, or use the command line:

avdmanager create avd \
  -n Pixel_Local \
  -k "system-images;android-35;google_apis;x86_64"

You can list and remove devices with emulator -list-avds and avdmanager delete avd -n Pixel_Local. Keep AVD files on a fast SSD when possible. Australian developers working on laptops with limited storage should also watch the SDK directory, because system images and snapshots consume several gigabytes.

Verify Acceleration And Graphics

Before launching a graphical device, ask the emulator which acceleration backend it can use:

emulator -accel-check

A healthy installation should identify KVM as usable. Launch the AVD with hardware graphics:

emulator -avd Pixel_Local \
  -accel on \
  -gpu host

-accel on makes a configuration problem visible instead of silently falling back to slower execution. -gpu host asks the emulator to use the host GPU. On modern Linux desktops this can provide a substantial improvement for scrolling, animations, and maps.

If the window is black, crashes, or shows corrupted rendering, try SwiftShader as a diagnostic fallback:

emulator -avd Pixel_Local \
  -accel on \
  -gpu swiftshader_indirect

This keeps CPU virtualisation acceleration while replacing host GPU rendering with software graphics. It is slower, but it helps separate a KVM problem from a Mesa, proprietary NVIDIA, Wayland, or X11 problem. Update the relevant graphics driver rather than accepting the fallback as the permanent solution.

The -no-snapshot option can help when a saved state became damaged:

emulator -avd Pixel_Local -accel on -gpu host -no-snapshot

Snapshots improve startup time, but they may preserve a broken graphics state after a driver update. Cold booting once often clears the issue.

Tune The Virtual Device For Daily Work

An emulator does not need flagship hardware settings to test an ordinary application. Start with two or four virtual CPU cores, a sensible amount of RAM, and a display resolution close to the devices used by the application’s audience. Excessive allocation can make the host desktop less responsive, especially on an ultrabook used for coding, documentation, and browser testing.

Useful launch options include:

emulator -avd Pixel_Local \
  -accel on \
  -gpu host \
  -no-boot-anim \
  -memory 3072

Disable animations inside the device when test speed matters. Keep snapshots enabled once the configuration is stable, but periodically perform a cold boot to catch problems that a saved state hides. For repeatable scripts, wait for Android to finish booting:

adb wait-for-device
adb shell 'until getprop sys.boot_completed | grep -m 1 1; do sleep 1; done'

A wired network connection is helpful when downloading large SDK images or Gradle dependencies, though the emulator itself can work over Wi-Fi. NBN performance varies by suburb and provider, so keeping commonly used system images cached locally avoids unnecessary downloads during a release week.

Australian app teams should also test location, time zone, and connectivity assumptions. Set the emulator to an Australian locale when validating date formatting, daylight-saving behaviour in Sydney or Melbourne, and local payment or delivery workflows. Test data should remain fictional: the Privacy Act 1988 and an organisation’s privacy obligations still matter when developing apps that handle personal information.

Diagnose Slow Or Failed Starts

The most common failure is a message saying that KVM is unavailable. Check firmware virtualisation, /dev/kvm, group membership, and whether the current shell was opened before the group change. If the host is itself virtualised, confirm that nested virtualisation is exposed. Running kvm-ok and emulator -accel-check gives two useful views of the same dependency.

If the emulator starts but performs poorly, identify whether CPU or graphics is responsible. Software CPU emulation usually produces very slow boot and interaction, while a graphics issue appears as flickering, a black screen, or broken animations. Test -gpu swiftshader_indirect, update Mesa or the proprietary driver, and remove stale snapshots before changing several settings at once.

A damaged AVD can be recreated without affecting the SDK:

avdmanager delete avd -n Pixel_Local
avdmanager create avd \
  -n Pixel_Local \
  -k "system-images;android-35;google_apis;x86_64"

For a CI machine, use a dedicated account, a fixed system image, and explicit emulator flags. For a desktop used in a Melbourne co-working space or a home office in Perth, keep the configuration documented in the project repository so a replacement laptop can be prepared consistently.

Area Recommended setting Typical symptom when missing
CPU firmware Intel VT-x or AMD-V enabled KVM unavailable
Linux access User belongs to kvm Permission denied for /dev/kvm
System image x86_64 image on Intel or AMD Slow instruction translation
Emulator acceleration -accel on Unexpected software fallback
Graphics -gpu host, with SwiftShader for diagnosis Black screen or rendering errors
Storage Local SSD for SDK and AVD files Long boots and slow snapshots

Once KVM, the emulator binary, and host graphics are working, the Android virtual device becomes a dependable part of a Linux development routine. Record the working package versions and launch flags, keep test data safe, and use a small, repeatable AVD rather than rebuilding the environment whenever an emulator error appears.


cat ~/interests.json

KeyValue
editorTerminal-first workflow
osMac OS X / Unix
vcsGit, distributed version control
deployCapistrano, cron automation
graphicsSVG, Adobe Illustrator troubleshooting
networkingIP validation, SSH, VPN

git log --oneline --reverse

2013-10-30

Solving SVG import issues in Adobe Illustrator CS6 and CC

When importing an SVG into Illustrator, the operation fails with an unknown error [CANT]. A workaround for this Adobe-side bug.

2013

Solving NDK build issues on OS X

Troubleshooting native development kit compilation problems on Mac OS X.

2013

Programmatically adding PHP generated TypoScript to the backend configuration

Integrating dynamically generated TypoScript into Typo3 backend setups using PHP.

2013

ArgumentError: Could not parse PKey: no start line

Debugging an SSH key parsing error encountered during deployment.

2011-08-04

Validating IP-Addresses in PHP

Using PHP filter functions with flags like FILTER_FLAG_IPV4 and FILTER_FLAG_IPV6, and understanding how filter_var handles reserved IP addresses.

2011-07-09

Cocoa: Using NSTrackingArea

A short tutorial on using Cocoa's NSTrackingArea to capture mouseEntered and mouseExited events.


cat ~/contact.txt

github: github.com/x3ro
stackoverflow: x3ro
coderwall: coderwall.com/x3ro
twitter: @x3rames