tauri-apps/tauri · error · tauri_cli::error::Error

Could not find an Android Emulator matching {t}

Error message

Could not find an Android Emulator matching {t}

What it means

The emulator-selection counterpart of the device matcher: when --target <t> is passed and no listed emulator (AVD) name fuzzy-matches t with a score above MIN_DEVICE_MATCH_SCORE (0), selection aborts. The emulator list comes from the Android SDK's emulator tooling, not from currently running devices.

Source

Thrown at crates/tauri-cli/src/mobile/android/mod.rs:764

fn emulator_prompt(env: &'_ Env, target: Option<&str>) -> Result<emulator::Emulator> {
  let emulator_list = emulator::avd_list(env).unwrap_or_default();
  if !emulator_list.is_empty() {
    let emulator = if let Some(t) = target {
      let (device, score) = emulator_list
        .into_iter()
        .rev()
        .map(|d| {
          let score = best_match(t, d.name()).map_or(0, |m| m.score());
          (d, score)
        })
        .max_by_key(|(_, score)| *score)
        // we already checked the list is not empty
        .unwrap();
      if score > MIN_DEVICE_MATCH_SCORE {
        device
      } else {
        crate::error::bail!("Could not find an Android Emulator matching {t}")
      }
    } else if emulator_list.len() > 1 {
      let index = prompt::list(
        concat!("Detected ", "Android", " emulators"),
        emulator_list.iter(),
        "emulator",
        None,
        "Emulator",
      )
      .context("failed to prompt for emulator")?;
      emulator_list.into_iter().nth(index).unwrap()
    } else {
      emulator_list.into_iter().next().unwrap()
    };

    Ok(emulator)
  } else {
    Err(Error::GenericError(

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. List available emulators: `emulator -list-avds` (or `ls $ANDROID_HOME/emulator` + avdmanager) and use the exact AVD name
  2. Create the AVD you reference: `avdmanager create avd -n <name> -k "system-images;android-34;google_apis;x86_64"`
  3. Ensure ANDROID_HOME points at the SDK that actually holds your AVDs (~/.android/avd)
  4. Drop --target and pick the emulator from the interactive list

Example fix

# before
tauri android dev --target myavd   # no AVD named 'myavd'
# after
$ANDROID_HOME/emulator/emulator -list-avds   # e.g. 'Pixel_7_API_34'
tauri android dev --target Pixel_7_API_34
Defensive patterns

Strategy: validation

Validate before calling

# verify an AVD with a matching name exists before using --target:
TARGET="Pixel_7_API_34"
$ANDROID_HOME/emulator/emulator -list-avds | grep -qx "$TARGET" || {
  echo "no AVD named $TARGET"; exit 1; }

Prevention

When it happens

Trigger: `tauri android dev --target <name>` where <name> does not resemble any available AVD name — unknown AVD, typo, or emulators listed under a different ANDROID_HOME than expected.

Common situations: AVD created under a different user/SDK path (CI service accounts); AVD deleted or renamed; wrong casing/whitespace in the target string; ANDROID_HOME pointing at an SDK without any AVDs.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/cb2539b7d05bb117. Report an issue: GitHub.