Why Adaptive Testing Still Needs a Better Workflow
Developers targeting Android’s ever‑expanding range of devices – from pocket‑sized phones to foldable phones, tablets and even car displays – have long relied on the Resizable Emulator bundled with Android Studio. While the visual UI lets you drag the screen edges or manually trigger a fold, the process can be slow when you need to repeat the same steps across several form‑factors.
Google’s latest developer blog post (31 August 2026) shows how you can bypass the graphical interface entirely by issuing fire‑and‑forget commands through the adb emu shortcut. The approach works from any terminal, can be scripted, and even supports multiple emulators running side‑by‑side.
“By integrating fire‑and‑forget commands into your command‑line workflow, you save a lot of time and resources compared to running multiple emulators simultaneously,” writes Rob Orgiu, Developer Relations Engineer.
Below is a practical rundown of the commands, how they map to real‑world testing scenarios, and why UK‑based developers (and the apps they ship to contract‑deal shoppers) should start using them today.
Targeting a Specific Emulator
When you have more than one virtual device active, you need to tell adb which one to talk to. Append the device’s serial number with the -s flag:
adb -s <serial> emu <command> <parameter>
You can retrieve the serials with adb devices. This makes it trivial to run a batch script that folds one device while rotating another.
Folding and Unfolding a Foldable Emulator
Foldable phones such as the Pixel Fold expose two distinct screen configurations:
- Closed – the external display only (smaller screen).
- Unfolded – the internal, larger display.
Instead of dragging the hinge in the UI, use:
adb emu fold # Switch to the closed posture
adb emu unfold # Return to the unfolded posture
Running these commands instantly changes the virtual screen size, allowing you to verify that your app preserves state, restores data and re‑layouts correctly across the two modes.
Rotating the Virtual Device
Orientation handling is a classic source of bugs. The emulator can now be rotated with a single line:
adb emu rotate # 90° clockwise rotation
The command triggers the same configuration change that a user would experience when turning the device, letting you test onConfigurationChanged, saved‑instance‑state handling and any UI tweaks that depend on portrait vs. landscape.
Simulating Physical Postures via Sensors
Beyond simple fold/unfold, Android emulators expose a posture sensor that mimics real‑world positions such as tabletop or tent mode. First, list the supported postures:
adb emu posture
Typical output looks like:
Usage: posture <posture_id>
1: closed
2: half‑opened
3: opened
You can then set a specific posture, for example the half‑opened (often used for tabletop mode):
adb emu posture 2
Note that not every AVD template supports every posture. The standard Pixel Fold and Resizable AVDs only recognise IDs 1‑3; attempting an unsupported ID returns an error.
Resizing the Emulator on the Fly
The Resizable Emulator adds a unique capability: you can switch between predefined screen sizes without dragging a corner. First, query the available presets:
adb emu resize-display
You’ll receive something akin to:
KO usage: "resize-display <index>"
0: phone
1: unfolded
2: tablet
Pick the index that matches the form‑factor you want to test:
adb emu resize-display 2 # Switch to tablet size
This is especially handy when you need to confirm that a single code base gracefully adapts from a handset to a large‑screen tablet layout.
Putting It All Together – A Sample Script
Below is a minimal Bash script that demonstrates a typical adaptive‑testing loop for a foldable app:
#!/usr/bin/env bash
# Choose the emulator you want to work with
EMULATOR_SERIAL=$(adb devices | grep emulator | head -n1 | cut -f1)
# Ensure the device is running
adb -s $EMULATOR_SERIAL wait-for-device
# 1. Start in unfolded mode and launch the app
adb -s $EMULATOR_SERIAL emu unfold
adb -s $EMULATOR_SERIAL shell am start -n com.example.myapp/.MainActivity
# 2. Rotate to landscape, capture a screenshot
adb -s $EMULATOR_SERIAL emu rotate
adb -s $EMULATOR_SERIAL exec-out screencap -p > unfolded_landscape.png
# 3. Fold the device, verify UI state
adb -s $EMULATOR_SERIAL emu fold
adb -s $EMULATOR_SERIAL exec-out screencap -p > folded.png
# 4. Switch to tablet size for a final check
adb -s $EMULATOR_SERIAL emu resize-display 2
adb -s $EMULATOR_SERIAL exec-out screencap -p > tablet.png
echo "All screenshots captured – review them to confirm layout correctness."
Running this script from a terminal performs the entire test suite in under a minute, something that would take several minutes of manual UI interaction.
Why This Matters for UK Android Users
While the commands are developer‑focused, the downstream effect reaches everyday Android users – especially those hunting for the latest contract deals on foldables or tablets. Apps that correctly handle folding, rotation and screen‑size changes feel more polished, retain data during posture switches and avoid the dreaded “app crashed” messages that can turn a potential buyer away.
With Android 17 pushing an adaptive‑first development model, manufacturers such as Samsung, Huawei and Google are rolling out more devices that change shape throughout the day. Faster testing pipelines mean developers can ship updates quicker, keeping the UK market stocked with apps that work seamlessly on the newest Pixel Fold, Galaxy Z Fold 5 or even emerging dual‑screen laptops.
Getting Started
- Launch an AVD that supports the features you need (Pixel Fold or Resizable are good starting points).
- Open a terminal – macOS, Linux or Windows Subsystem for Linux all work.
- Run the commands shown above, or integrate them into your CI pipeline.
- Consult the official documentation for the full list of supported commands and any device‑specific quirks.
By adopting these terminal shortcuts, you’ll shave minutes off each test cycle, free up system resources, and ultimately deliver a smoother adaptive experience to the UK’s increasingly diverse Android audience.
Happy testing, and may your apps adapt as gracefully as the devices they run on!