dotnet add package RecursiveAI.OneApp dotnet tool install -g RecursiveAI.OneApp.Cli
Requires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
Use a Linux x86-64 host with the Android SDK (platform, build-tools, and platform-tools), the NDK, and a POSIX shell with jq. These steps don’t cover Windows or macOS hosts. Start the emulator from the command line and wait until Android finishes booting.
app=$(oneapp run . --android | jq -er .info) oneapp tap '#count' --app "$app" oneapp type Ada --into '#name' --app "$app" oneapp swipe '#list' --dy -140 --app "$app"
Unzip the example, then run the commands above from the unzipped folder. The zip pins OneApp 1.2.1; install the matching CLI with --version 1.2.1 if you want the same tool version.
oneapp run prints JSON with the path to a connection file in info; jq extracts that path for the --app arguments.
Full program
using OneApp; public static class Program { public static int Main(string[] args) { using var host = AppHost.Create(new AppOptions(new MainPage()) { Title = "EmulatorTest", AppId = "org.example.emulatortest", }); host.Run(); return 0; } }
OneApp builds the MainPage class from MainPage.html when you build the project. These are the controls the test targets:
<main class="page"> <button id="count" on:click="Count">Taps: {Taps}</button> <label for="name">Name</label> <input id="name" value="{Name}" on:input="Changed" /> <p id="greeting">Hello, {Name}</p> <section id="list" class="list"> <p>Start of list</p> <p id="last">End of list</p> </section> </main>
The included MainPage.cs increments Taps and copies each input event’s value to Name. MainPage.css gives the list a 120-pixel scroll area and puts #last below its initial view. In the example folder, sh test.sh launches the app, runs the three actions, and reads the result back:
Taps: 1 Hello, Ada End of list
If oneapp run can’t find a device, run adb devices and wait until the emulator shows device, not offline.
Variations
Choose an emulator when more than one device is attached. Use its serial from adb devices. Replace the example serial with yours:
oneapp run . --android --serial emulator-5554Related recipes
The short answer
Start an Android virtual device and run oneapp run . --android from a OneApp project. OneApp builds a Debug package for that device, installs it, and launches the app. It forwards the app’s local test listener to your computer with adb forward. Use the returned info file with --app so tap, type, swipe and query all reach the app you just launched.
How do I launch the Android emulator from the command line?
Create an Android Virtual Device first. A virtual device is a named configuration that includes an Android system image. The Android emulator command-line guide covers the startup options. With the SDK’s emulator and platform-tools directories on your path, list your devices, then boot one by name. The command below uses Pixel_API_35 as an example name; substitute yours.
emulator -list-avds emulator -avd Pixel_API_35 -no-window
Leave the emulator running and issue adb devices from another terminal. Wait until Android has finished booting and the home screen is available before running the app. The emulator’s name in -avd is not the serial you pass to OneApp: that serial comes from adb devices.
Can I run an APK on an emulator?
Yes. If you already have an APK, Android’s adb install can install it on the emulator. If you have the C# source and want to drive the UI from the terminal, use oneapp run . --android instead. It starts a Debug build with the listener and returns the file the other OneApp commands use. Installing an APK alone does not set up that connection.
How do I test Android touch input from the command line?
Use tap on a button’s CSS selector to send touch events instead of invoking its handler directly. type --into targets an editable field; add --clear when replacing an existing value. Start a swipe inside the scrollable element. A negative --dy moves the finger up to scroll toward later items. Swipe distances are in CSS pixels, not emulator screen pixels. Check an observable result after each action: a changed counter, new text, or a list item that is now visible and can be hit. The harness reference lists the query fields and what they mean.