Can't use adb when connected to VPN
Asked Answered
D

1

9

My PC and Android TV device are in the same net section,so I can use adb connect the debugging device.Also ,I use adb devices command,it shows device on work.But when My PC and device use the same vpn based on the previous internet,I try to ping the device IP,it worked,then I use adb connect the device,it shows connect,but when input adb devices command , it shows device offline. I'm sure the error can't be caused by adb version,for it can work when disconnect the vpn.who can help me? I'm very appreciate for that.

Dunderhead answered 29/9, 2015 at 6:25 Comment(3)
There are many different ways VPN is realized. Also, handling of local addresses is different and usually a configuration option - since you say you can access device via other means, that should be set up correctly though. You might use wireshark to debug the connection on a package level, that usually is helpful, and doable even with mediocre networking knowledge.Endrin
Thanks for your answer,maybe you got the cause reason.But other colleagues use my vpn account, do the same operation,he can use adb connect the debugging device, also can use adb shell command .Except that, I disconnect the wired network,try to let my PC and the target device connect the same wifi, then I can use adb connect them ,and both the adb shell command and adb remount command work ,but sometimes device offline error may happen ,and I can't make CTS test.Dunderhead
I'm also facing this issuePiave
L
3

If your PC and device are on the same LOCAL network, all you need to do is find the local IP address of the device (something like: 192.168.xx.xx). Then type:

adb disconnect

adb connect 192.168.xx.xx.

It'll connect again. Works for me.

The only time it does not work is when the device is the one providing the LOCAL network, e.g., your phone's mobile Hotspot. Using a VPN like this does not work directly. Whenever you use a VPN and try using ADB for a mobile hotspot (and the hotspot device is the one you're trying to connect to), you'll realize that the device goes offline. This is because when you enter "adb connect <REMOTE_HOST>", your PC tries to route your device IP (REMOTE_HOST) via the VPN network, which will not be accessible since your ISP does not allow inbound connections to your device.

An alternative option, which I use for my device (Phone), is to use a wired connection to my PC via a USB cable. It might work for the Android TV if the proximity b/w TV and your laptop is not a problem.

Another alternative (supposing you're trying to connect a phone/Android TV) is to use another phone or router to create a hotspot. Then connect both your PC and phone/Android TV to the hotspot. Find the phone/Android TV IP address 192.168.xx.xx and enter:

adb connect 192.168.xx.xx.

Lively answered 2/8, 2022 at 5:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.