tauri-apps/tauri · error · tauri_cli::error::Error
Could not find an Android device matching {t}
Error message
Could not find an Android device matching {t} What it means
When `--target <t>` (device/emulator name filter) is passed, the CLI lists connected adb devices and fuzzy-scores each name against t; MIN_DEVICE_MATCH_SCORE is 0, so the best candidate must score above 0 (share at least some similarity). This error means the best match scored 0 — no connected device name resembles the requested target at all.
Source
Thrown at crates/tauri-cli/src/mobile/android/mod.rs:718
.into_iter()
.filter(|d| d.status() == ConnectionStatus::Connected)
.collect::<Vec<_>>();
if !device_list.is_empty() {
let device = if let Some(t) = target {
let (device, score) = device_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 device matching {t}")
}
} else if device_list.len() > 1 {
let index = prompt::list(
concat!("Detected ", "Android", " devices"),
device_list.iter(),
"device",
None,
"Device",
)
.context("failed to prompt for device")?;
device_list.into_iter().nth(index).unwrap()
} else {
device_list.into_iter().next().unwrap()
};
log::info!(
"Detected connected device: {} with target {:?}",
device,View on GitHub (pinned to 52e4b6e71d)
Solutions
- Run `adb devices -l` to list actually connected devices and their names
- Start the emulator first (`emulator -avd <name>` or via Android Studio) and wait for boot, then rerun with the matching --target
- Re-accept the USB debugging authorization dialog on the device if it shows unauthorized
- Drop --target to get the interactive device picker (or single-device auto-select)
Example fix
# before tauri android dev --target Pixel9 # no device named anything like 'Pixel9' # after adb devices -l # see real names, e.g. 'emulator-5554' tauri android dev --target emulator-5554
Defensive patterns
Strategy: validation
Validate before calling
# verify the target exists among adb-visible device names before invoking tauri:
TARGET="Pixel_7_API_34"
adb devices | tail -n +2 | awk '{print $1}' | grep -q . || { echo 'no devices'; exit 1; }
adb devices -l | grep -q "$TARGET" || echo "warning: no device name contains $TARGET" Prevention
- Run `adb devices -l` first and copy the exact device name into --target
- Start and fully boot the emulator before passing its name as --target
- In CI, create the AVD deterministically (avdmanager + emulator -boot-anim false) and reference that exact name
When it happens
Trigger: `tauri android dev --target foo` (or -t) where no adb-visible device name contains characters matching 'foo' — e.g. emulator not started yet, device offline/unauthorized, or a typo in the target.
Common situations: Referencing an AVD name before booting it (cold emulator list); USB debugging not authorized so the device shows as 'unauthorized'; typos or stale device codenames; CI passing a target name from a different machine.
Related errors
- Could not find an Android Emulator matching {t}
- Missing OS permission to access path "{path}": {e}
- No external IP detected.
- failed to read missing addr file {}: {e}
- Android SDK not found. Make sure the SDK and NDK are install
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/aa06d496a5051019.
Report an issue: GitHub.