Skip to main content
Glama

start_emulator

Start an Android emulator and wait for it to come online. Specify the AVD name to launch the virtual device for testing and development.

Instructions

Start an Android emulator. Waits up to 60s for it to come online.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
avd_nameYesName of the AVD to start (from list_avds)

Implementation Reference

  • The `startEmulator` method in the `Adb` class handles launching the emulator and polling until the device appears online.
    async startEmulator(avdName: string): Promise<string> {
      const beforeDevices = await this.getDevices();
      const beforeIds = new Set(beforeDevices.map((d) => d.id));
    
      const child = spawn(this.emulatorPath, ["-avd", avdName], {
        detached: true,
        stdio: "ignore",
      });
      child.unref();
    
      const maxWaitMs = 60_000;
      const pollIntervalMs = 2_000;
      const start = Date.now();
    
      while (Date.now() - start < maxWaitMs) {
        await new Promise((r) => setTimeout(r, pollIntervalMs));
        const currentDevices = await this.getDevices();
        const newDevice = currentDevices.find(
          (d) => !beforeIds.has(d.id) && d.state === "device",
        );
        if (newDevice) return newDevice.id;
      }
    
      throw new Error(`Emulator "${avdName}" did not come online within ${maxWaitMs / 1000}s`);
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/martingeidobler/android-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server