79805116

Date: 2025-10-30 18:47:17
Score: 0.5
Natty:
Report link

still having this problem in 2025 and it took some work but I got a solution working. I have networkingMode=mirrored , no JAVA_HOME conflicts, and most other connections work fine but I had to set up forwarding using usbipd-win to get it working.

install usbipd-win on Windows, using admin PowerShell, run

winget install --interactive --exact dorssel.usbipd-win

or download the .msi from https://github.com/dorssel/usbipd-win/releases

connect your phone via USB

open PowerShell as admin and list devices with usbipd list noting the phone's BUSID (e.g. 1-4, and it's VID:PID) then:

restart adb in WSL: adb kill-server; adb start-server; adb devices and you should see the device showing up

after I did this the first time and selected "always allow this connection" from my phone it's worked pretty much every time. occasionally I have to do it again after a restart but it's pretty stable. I did write a script to automate the whole thing and alias it so it's easier to run if I have to reset the binding

# AttachAndroidToWSL.ps1
$deviceVidPid = "<VID:PID>"

Write-Host "Searching for device with VID:PID $deviceVidPid..."

$devices = usbipd list
$targetDevice = $devices | Where-Object {
$_ -match $deviceVidPid -and
$_ -notmatch "Attached"
}

if ($targetDevice) {
$busId = ($targetDevice -split " ")[0]
Write-Host "Found device: $targetDevice"
Write-Host "Attaching device with BUSID $busId to WSL..."

try {
usbipd bind --busid $busId | Out-Null
usbipd attach --wsl --busid $busId
Write-Host "Device attached successfully. Check adb devices in WSL."
} catch {
Write-Error "Failed to attach device: $($_.Exception.Message)"
}
} else {
Write-Host "Device with VID:PID $deviceVidPid not found or already attached."
Write-Host "Current USB devices:"
usbipd list
}

# Restart adb server in WSL (optional)
# Change WSL distribution name if it's not 'Ubuntu'
# wsl -d Ubuntu -e bash -c "adb kill-server; adb start-server"

and a connect-android powershell alias is helpful to quickly bind

function Connect-Android {
    C:\path\to\script\AttachAndroidToWSL.ps1
}
Set-Alias -Name connect-android -Value Connect-Android
Reasons:
  • Blacklisted phrase (1): I have to do
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: jon.bray.eth