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…

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, avdmanager and a short Python script, so it carries over to any Android project. One emulator per kind per checkout Each checkout gets its own devices, named after the kind of device and the folder they belong to: a TV, a phone, and a tablet when a change needs one. The name makes a device easy to find again the next time you work in that checkout. Making one is cheap if you keep a base image around.

On a Mac with APFS, a copy-on-write copy of the AVD folder is instant and takes no extra disk, so a clone is a copy plus a few edits: drop the lock files and snapshots, point the config at the new name, switch the hardware keyboard on, and write the small .ini that registers it. A simplified sketch of the idea, with generic names: # Simplified sketch of cloning an AVD and booting it on a chosen port.

KIND=phone # or tv, tablet SRC=base_$KIND NEW=${KIND}_$(basename "$PWD") PORT=5554 # an explicit port for this emulator cp -c -R ~/.android/avd/$SRC.avd ~/.android/avd/$NEW.avd # copy-on-write cd ~/.android/avd/$NEW.avd rm -rf *.lock snapshots # state that belongs to the source sed -i '' -e "s/^avd.id=.*/avd.id=$NEW/" \ -e "s/^avd.name=.*/avd.name=$NEW/" \ -e "s/^hw.keyboard=.*/hw.keyboard=yes/" config.ini # ...write ~/.android/avd/$NEW.ini pointing at this folder...

emulator -avd $NEW -port $PORT -gpu host \ -no-snapshot-load -no-snapshot-save When there is no base to clone, avdmanager create avd with the right system image and device profile does the same job. Boot a clone cold the first time. Give each emulator an explicit port An emulator takes a console port (and its neighbour for adb), and its serial is emulator-. Without -port, a restarted emulator takes the lowest free pair and its serial can change.

Source disclosure

This is a source-linked briefing. Read the original report from Dev Community .