{"record":{"id":"cb2539b7d05bb117","repo":"tauri-apps/tauri","slug":"could-not-find-an-android-emulator-matching-t","errorCode":null,"errorMessage":"Could not find an Android Emulator matching {t}","messagePattern":"Could not find an Android Emulator matching (.+?)","errorType":"exception","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/android/mod.rs","lineNumber":764,"sourceCode":"\nfn emulator_prompt(env: &'_ Env, target: Option<&str>) -> Result<emulator::Emulator> {\n  let emulator_list = emulator::avd_list(env).unwrap_or_default();\n  if !emulator_list.is_empty() {\n    let emulator = if let Some(t) = target {\n      let (device, score) = emulator_list\n        .into_iter()\n        .rev()\n        .map(|d| {\n          let score = best_match(t, d.name()).map_or(0, |m| m.score());\n          (d, score)\n        })\n        .max_by_key(|(_, score)| *score)\n        // we already checked the list is not empty\n        .unwrap();\n      if score > MIN_DEVICE_MATCH_SCORE {\n        device\n      } else {\n        crate::error::bail!(\"Could not find an Android Emulator matching {t}\")\n      }\n    } else if emulator_list.len() > 1 {\n      let index = prompt::list(\n        concat!(\"Detected \", \"Android\", \" emulators\"),\n        emulator_list.iter(),\n        \"emulator\",\n        None,\n        \"Emulator\",\n      )\n      .context(\"failed to prompt for emulator\")?;\n      emulator_list.into_iter().nth(index).unwrap()\n    } else {\n      emulator_list.into_iter().next().unwrap()\n    };\n\n    Ok(emulator)\n  } else {\n    Err(Error::GenericError(","sourceCodeStart":746,"sourceCodeEnd":782,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/android/mod.rs#L746-L782","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["List available emulators: `emulator -list-avds` (or `ls $ANDROID_HOME/emulator` + avdmanager) and use the exact AVD name","Create the AVD you reference: `avdmanager create avd -n <name> -k \"system-images;android-34;google_apis;x86_64\"`","Ensure ANDROID_HOME points at the SDK that actually holds your AVDs (~/.android/avd)","Drop --target and pick the emulator from the interactive list"],"exampleFix":"# before\ntauri android dev --target myavd   # no AVD named 'myavd'\n# after\n$ANDROID_HOME/emulator/emulator -list-avds   # e.g. 'Pixel_7_API_34'\ntauri android dev --target Pixel_7_API_34","handlingStrategy":"validation","validationCode":"# verify an AVD with a matching name exists before using --target:\nTARGET=\"Pixel_7_API_34\"\n$ANDROID_HOME/emulator/emulator -list-avds | grep -qx \"$TARGET\" || {\n  echo \"no AVD named $TARGET\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use exact AVD names from `emulator -list-avds` (case-sensitive)","Create AVDs via avdmanager in CI with pinned names","Keep ANDROID_HOME consistent between AVD creation and tauri runs"],"tags":["android","emulator","avd","device-selection","fuzzy-match"],"backgroundTag":"android-emulator-not-found","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","contentChangedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}