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 an Android emulator with Google Play Services for API testing

When building mobile applications that rely on Google services, the development environment needs to mirror production as closely as possible. An Android Virtual Device configured with Google Play Services provides a realistic sandbox for verifying authentication flows, location requests, in-app purchases and push notifications without touching a physical handset. For Australian developers juggling time zones between Sydney, Melbourne and Perth, a well-tuned virtual device can also shave hours off the feedback loop compared with waiting for hardware to ship from a supplier overseas.

This walkthrough covers selecting the correct system image, provisioning Play Services, configuring networking for local backends and validating the end-to-end setup. It also flags a few quirks that surface on Windows, macOS and Linux workstations, including a note for those working from regional areas where NBN upload speeds make large SDK transfers a bottleneck.

Choosing the right system image and API level

The first decision is which API level and architecture the virtual device should emulate. Android Studio's Device Manager lists dozens of images, and the choice affects whether Play Services will run at all. Images labelled "Google Play" ship with the Play Store and Play Services preinstalled, while "Google APIs" images include the Google APIs console but no Play Store. For testing anything that calls the Play Services SDK, the Play image is mandatory.

Architecturally, x86_64 images run faster on modern laptops thanks to hardware acceleration, whereas ARM images are reserved for edge cases such as native libraries compiled exclusively for ARM. Developers using Windows 11 with Hyper-V enabled, or macOS on Apple silicon using the built-in HVF, will get the best results from x86_64. In Australian offices where hardware budgets are tight, picking a smaller screen profile like a 5.5-inch 1080p device keeps RAM consumption manageable on ageing fleet laptops.

Match the API level to your minSdk. If you target API 24 as the floor but want to test modern behaviour, create two AVDs side-by-side. This habit saved a Brisbane-based team weeks of regression work when a Maps SDK call behaved differently on API 30 versus API 33.

Provisioning Google Play Services on the AVD

After the image downloads and the AVD boots, sign in with a Google account to activate Play Services. The account does not need to be the developer account, and using a fresh test account avoids contaminating real user data, which is a small but important step for teams operating under the Privacy Act 1988, which governs how personal information is handled even in test environments.

Open the Play Store from the AVD's app drawer and complete the sign-in flow. A short wait follows while Play Services syncs in the background; this is normal. If the store shows a blank white screen, the image likely lacks Play Services and needs to be swapped for a "Google Play" variant. Updates to the Play Services APK arrive automatically once signed in, so the AVD stays current without manual sideloading. For apps that depend on Auth or FCM, confirm the version by visiting Settings ▸ Apps ▸ Google Play Services and noting the version number against the release notes page for compatibility.

Configuring networking for local and remote endpoints

Most API calls during development point at localhost or a staging server. The emulator exposes host networking through 10.0.2.2, which maps to the developer machine's loopback. If the backend lives in a Docker container, use 10.0.2.2 alongside the container's published port. For developers behind corporate proxies in Melbourne's CBD offices, configuring the proxy under Settings ▸ Network ▸ Wi-Fi (using the extended settings dialog) ensures that HTTPS traffic from the AVD does not hit a captive portal.

When the API performs IP validation server-side, the emulator's outbound address can occasionally trigger false positives on rate limiters. Reviewing a reference on validating IP addresses in PHP can clarify how to whitelist the 10.0.2.0/24 range in development while keeping production strict. For teams split across AEST and AWST, scheduling emulator-based integration tests outside business hours keeps CI queues short and avoids contention with local app builds.

Verifying the setup with ADB and sample calls

Before integrating Play Services into the app, run a quick sanity check from the command line. adb shell pm list packages | grep google should return a handful of com.google.* entries, confirming Play Services is installed. Then issue adb shell pm path com.google.android.gms to locate the APK path, which is useful when scripting automated checks.

For a real API call, install a small test harness that hits the Geolocation or Identity API and logs the response. If the call returns PERMISSION_DENIED unexpectedly, the device's Play Services may be outdated; open the Play Store and update. Cold boot times on first launch can stretch past two minutes on older hardware, so enabling the graphics option "Hardware - GLES 2.0" and disabling boot animation cuts that down considerably for teams in Perth where loaner laptops are common.

Troubleshooting performance and compatibility quirks

Even with the right image selected, rough patches happen. A frequent complaint involves the emulator hanging on the boot animation when Hyper-V is disabled on Windows; re-enabling it in the Control Panel under "Turn Windows features on or off" and restarting usually resolves the stall. On macOS, especially on older Intel hardware, HAXM may need a reinstall after a macOS major version upgrade, which developers travelling between Sydney and client sites occasionally overlook until the laptop reboots.

When testing apps that use scoped storage or background restrictions introduced in API 29+, the AVD may behave differently than a physical Pixel device. Running the same APK on both surfaces catches regressions early. For those cross-platform developers who also build for Apple ecosystems, a look at how tracking areas are handled in Cocoa offers a parallel pattern for mouse and touch hit-testing that occasionally informs event handling design on Android. Finally, keep the AVD's internal storage under 80 percent full; a full userdata partition silently breaks Play Services sync, which masquerades as an authentication bug far downstream.

Image Type Play Store Play Services Best For Limitations
Google Play Yes Latest stable Real-world auth, FCM, Maps Larger download, slower first boot
Google APIs No Bundled snapshot Unit testing Google APIs SDK Cannot update Play Services from store
Default (AOSP) No None Pure UI tests, no Google deps No Maps, Auth or Play Billing

The emulator is a powerful tool, but it complements rather than replaces physical device testing. Rotate AVDs across API levels, screen densities and locales before pushing builds, and keep an eye on Play Services version drift between the emulator and production. If a step in this guide misbehaved on your setup, drop a comment with the error log and your host operating system; troubleshooting notes from the community shape the next revision. Subscribe for follow-ups on CI integrations and Firebase Test Matrix workflows.


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