{
  "id": 23687914,
  "title": "Emulator testing for an Android TV and phone app",
  "url": "https://urgent.news/2026/12/05/emulator-testing-for-an-android-tv-and-phone-app",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-12-05T20:00:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/yonto/emulator-testing-for-an-android-tv-and-phone-app-3djc"
  },
  "original_language": null,
  "account": "Yonto Player is a shared codebase, comprising both Android TV and phone/tablet applications. To test this dual application setup, one must run both applications concurrently on emulators, maintaining a streamlined setup that operates seamlessly in the background. This post serves as a guide for any individual conducting this type of testing, particularly when working with multiple repositories on the same machine. The process primarily involves using adb, avdmanager, and a brief Python script, rendering it applicable to any Android project.\n\nEach repository necessitates its own set of emulators, identified by their device type and the directory they are housed in: a television, a smartphone, and a tablet when a modification necessitates one. The name facilitates easy identification of the device the next time you work in that repository. Creating an emulator is straightforward if you maintain a base image. On a Mac equipped with APFS, a copy-on-write copy of the AVD folder is instantaneous and consumes no additional disk space, making a clone simply a copy with minor modifications: eliminating lock files and snapshots, renaming the configuration to the new name, activating the hardware keyboard, and writing a concise .ini file to register it.\n\nThe process of cloning an AVD and booting it on a selected port is as follows:\n\n1. Define the device type (TV, phone, or tablet) using the KIND variable.\n2. Create a base image named SRC based on KIND.\n3. Designate a new name for the cloned emulator using ${KIND} _ $(basename \" $PWD \") and store it in $NEW.\n4. Modify the AVD configuration file to set the AVD ID, name, and enable the hardware keyboard.\n5. Point the config.ini to the newly created AVD folder.\n6. Execute the emulator with the specified AVD, port, and GPU settings.\n\nIn cases where no base image exists, avdmanager can create the AVD with the appropriate system image and device profile. Upon first boot, each emulator is assigned an explicit port. Adapting the Android Gradle plugin's install* and connected* tasks to run against all attached devices allows for comprehensive testing of the applications.\n\nBy specifying ANDROID_SERIAL in conjunction with the command and utilizing -s with adb, each command can be executed independently. An instrumented test run also uninstalls the app and its test APK upon completion, ensuring a clean slate for subsequent tests.\n\nEmploying the host GPU via -gpu host ensures smooth frame rates. While emulator timing may not correspond to device timing, this method is suitable for comparative analysis rather than providing precise measurements. To evaluate timing accurately, employ a script to capture timestamps, thereby obtaining a quantifiable result.\n\nA comprehensive smoke test has been developed to automate the testing process. This script takes the device type (phone or TV), port, and optional APK as input parameters. Upon execution, it installs the APK if provided, clears the app's data, launches the application, and executes a series of predefined steps. For the phone, the script verifies the app's media session and playback functionality. For the TV, it checks for audio playback and ensures the app remains responsive to user input. If any step fails, the script captures a screenshot titled failure, logs the crash, outputs a FAIL message, and terminates with a status code of 1. Otherwise, it exits with a status code of 0.\n\nThis smoke test does not judge the visual appearance of the screen but rather confirms that the fundamental functionalities are operational. Ultimately, the smoke test aims to validate that the core features are functioning as intended, leaving aesthetic evaluations to more comprehensive testing procedures.",
  "summary": "Yonto Player is one codebase with an Android TV app and a phone and tablet app. Testing it means running both on emulators, repeatedly, and keeping the setup simple enough that it stays out of the way. This post is the setup I would hand to anyone testing a TV app and a phone app side by side, especially with more than one checkout of the repo on the same machine. Most of it is plain adb ,…",
  "summary_source": "publisher",
  "key_points": [
    "Yonto Player is dual Android TV and phone app",
    "Testing requires separate emulators per device type",
    "Smoke test automates APK installation, app launch, and functionality checks"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}