{"record":{"id":"aa06d496a5051019","repo":"tauri-apps/tauri","slug":"could-not-find-an-android-device-matching-t","errorCode":null,"errorMessage":"Could not find an Android device matching {t}","messagePattern":"Could not find an Android device matching (.+?)","errorType":"exception","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/android/mod.rs","lineNumber":718,"sourceCode":"    .into_iter()\n    .filter(|d| d.status() == ConnectionStatus::Connected)\n    .collect::<Vec<_>>();\n  if !device_list.is_empty() {\n    let device = if let Some(t) = target {\n      let (device, score) = device_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 device matching {t}\")\n      }\n    } else if device_list.len() > 1 {\n      let index = prompt::list(\n        concat!(\"Detected \", \"Android\", \" devices\"),\n        device_list.iter(),\n        \"device\",\n        None,\n        \"Device\",\n      )\n      .context(\"failed to prompt for device\")?;\n      device_list.into_iter().nth(index).unwrap()\n    } else {\n      device_list.into_iter().next().unwrap()\n    };\n\n    log::info!(\n      \"Detected connected device: {} with target {:?}\",\n      device,","sourceCodeStart":700,"sourceCodeEnd":736,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/android/mod.rs#L700-L736","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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)"],"exampleFix":"# before\ntauri android dev --target Pixel9   # no device named anything like 'Pixel9'\n# after\nadb devices -l                       # see real names, e.g. 'emulator-5554'\ntauri android dev --target emulator-5554","handlingStrategy":"validation","validationCode":"# verify the target exists among adb-visible device names before invoking tauri:\nTARGET=\"Pixel_7_API_34\"\nadb devices | tail -n +2 | awk '{print $1}' | grep -q . || { echo 'no devices'; exit 1; }\nadb devices -l | grep -q \"$TARGET\" || echo \"warning: no device name contains $TARGET\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["android","adb","device-selection","fuzzy-match","emulator"],"backgroundTag":"android-device-not-found","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","contentChangedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}