Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1K
Visualizações
ADB device list empty using WSL2

I'm trying to debug / connect up a device for development using WSL2 (Ubuntu). I've followed steps on this post https://stackoverflow.com/a/58229368/21061 which sets up ADB on both Windows and Linux using the same ADB version.

Once I've done that however, I get an empty list of devices in the Ubuntu terminal. I've tried killing and restarting the ADB server from the Windows command line and that doesn't seem to make any difference. Is this not possible in WSL2 or is there something I'm missing?

over 4 years ago · Santiago Trujillo
4 Respostas
Responde à pergunta

0

This answer worked for me using WSL 2:

On Windows:

adb tcpip 5555

Then on WSL 2:

adb connect [ip device]:5555

If it's the first time, it's going to ask you for permission in your phone, make sure to check the box to always grant permission. Then restart adb and connect again:

adb kill-server
adb connect [ip device]:5555

You can get your [ip device] from: Settings > About device > Status. It has a form like: 170.100.100.100

over 4 years ago · Santiago Trujillo Relatório

0

Jorge's answer is fine, but beginners like me may need some more details.

[ip device] is [YOUR_PHONE_IP] address. To get the IP address of your phone, go to "Settings -> About phone -> Status -> IP address". It will probably be something like 192.168.x.y.

I did not add adb to my PATH variable - neither in Windows nor in Linux/WSL2. Instead I just downloaded the latest version for both OS's using the links below:

https://dl.google.com/android/repository/platform-tools-latest-linux.zip https://dl.google.com/android/repository/platform-tools-latest-windows.zip

Once I unzipped platform-tools I had to change directory to the unzipped folder (cd platform-tools) in both PowerShell and WSL2.

Then in PowerShell on Windows, I run .\adb tcpip 5555 in the platform-tools folder.

In WSL2 terminal, I run ./adb connect 192.168.2.199:5555 (where 192.168.2.199 was my PHONE_IP address).

The first time you connect using [YOUR_PHONE_IP] address, you will be prompted to confirm the connection. The adb might say it failed to connect while it was waiting for the confirmation. If so, run ./adb kill-server in the WSL2 terminal and then run ./adb connect [YOUR_PHONE_IP]:5555 again.

You can display the list of attached devices via .\adb devices in PowerShell and ./adb devices in WSL2.

That is all. Now you should be able to debug your phone using WSL2.

over 4 years ago · Santiago Trujillo Relatório

0

we can do it more easily on WSL2

if we installed adb in windows and the path is /mnt/c/platform-tools/adb.exe

the WSL2 adb install at /usr/bin/adb

let change adb to adb_bk and set ln -s to link adb.exe

sudo mv /usr/bin/adb /usr/bin/adb_bk

sudo ln -s /mnt/c/platform-tools/adb.exe /usr/bin/adb

now we can use adb and work at bash script

try it

over 4 years ago · Santiago Trujillo Relatório

0

I was trying with this myself to get WSl2 working and i didn´t found any fast way to do this, this is easy and it is safe for everyone that wanna solve the problem:
printf '\n%s\n%s\n' \
'### Alias  for Android Debugging in WSL2' \
'alias adb="/mnt/c/Program\ Files\ \(x86\)/adb/adb.exe"' \ 
 >> ~/.bashrc

source ~/.bashrc
And now we can work as we wants in WSL1/WSL2 shell:
C:\> adb devices
List of devices attached
P1CN21AKXAZ     device

If adb.exe in windows will find your android device then also adb in wsl will. I writing this since I dont recommending anyone to use adb tcpip (that is recommended on few places I seen) without know exactly what risks it entails. I linking my script for hacking any android device within 1-3 seconds by copy and paste from devices that used adb tcpip command without understanding consequences, I want to point out that I am writing this to announce how dangerous it can be to give advice on something without being equal to giving the advice that when you are done, turn it off ASAP!

For people using over tcpip and is done with their tasks, execute:

adb disconnect
Of course you can create an symlink into /usr/bin also for using it system-wide if that is prefered.
 ln -s "/mnt/c/Program\ Files\ \(x86\)/adb/adb.exe" /usr/bin/adb

https://pastebin.com/raw/DtFSMBsF

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda