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.
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.
Related
My android device is paired with the PC with adb pair. I can connect it over wifi with adb connect <IP:Port No>. I want to automate the connection process, but since the port number changes every time I restart or disconnect the device, I need to look it up from the device and enter the port number in the automation script.
Is there any way to get the port number of the paired device from adb (or any other tool) from the PC without connecting it?
[Note: This certainly seems possible since after starting the android studio the device gets connected over wifi automatically. So android studio does get the port number of the paired device automatically.]
How to get adb logs via bluetooth?
need to connect an android device to my laptop to get the adb logs, but through usb cable its not working.
Dude, you don't need Bluetooth to do so, you can get ADB logs via Wi-Fi.
The steps:
Connect your device to your laptop via USB (yes, you've read right, if your USB cable is not working, you can use an alternative USB cable temporarily or borrow one from your friends).
Type adb tcpip 5555 in the terminal
Type adb connect XXX.XXX.X.X (the X's represent the local IP address of your mobile device, if you don't know your device's IP, go to Settings > Wi-Fi > Advanced).
You can disconnect your device from your laptop and now you can debug your apps wirelessly.
If you really need Bluetooth to use ADB. Bad news! That's not even possible.
I have successfully managed to install the Android Things Dev Preview onto my Raspberry Pi.
I have a problem though. When I first started installing my own applications I was able to connect to the Raspberry Pi through Ethernet, because it displayed the IP address on the TV when I booted up the Raspberry Pi.
Now because I have the Raspberry Pi already running an application, when I boot it up, it is automatically booting into my application without showing the initial screen with the IP address (and I forgot my IP address 🤔).
Is there an easy way to get the IP address of the Raspberry Pi, or connect to it when I don't know the IP address? Even a command to get a list of all available ADB devices on the network would help.
It would be great if when connected to a certain Wi-Fi, you could run something like:
adb network devices
Which could give a list of ADB devices on the network you are on.
The Raspberry PI Automatically broadcasts Android.local and should resolve to the IP address assigned to your Pi on port 5555.
Running the following:
adb connect Android.local
The command above is effectively the same as running:
adb connect <ip-address>:5555
Note: This will only work if your host platform supports multicast DNS service discovery.
This information was found in the documentation here by step 7 https://developer.android.com/things/hardware/raspberrypi.html
You can scan your network for points with ports 5555/5554 open, for example,
nmap -p 5555,5554 192.168.0.2-100
will scan in range 2-100 for any IP addresses with those ports open.
Or you can check in your router which devices are connected
On OS X you can scan for all devices that publish itself as Android.local
dns-sd -Q Android.local
I believe you need Bonjour on Windows/Linux to get something similar, but I'm still not familiar with them.
After figuring out the correct IP for the desired device you can connect as usual:
adb connect <ip-address>:5555
If multicast DNS is not supported on host platform and you have access to your router, you can simply log into it and view the list of connected devices.
You will be able to view all the devices no matter if mDNS is available or if there are any ports opened on the device (or if you don't know which port is opened).
The easiest way how to get to the initial screen with IP address from your application is to connect a USB keyboard to your Raspberry Pi then pressing escape key once :)
I had the very same problem recently and the easiest way in my opinion is that to just install a simple app on your phone (in my case Fing) that shows all the connected devices to your local connection including th RPI with their ip address. So then you are good to go!
I'm debuging an android application using my android smartphone (Sony Experia) and I need to connect to the computer's local host through the android app I'm developing. I tried several methods (USB tethering, Wifi hotspot) but I couldn't achieve it. Please support me with a solution. I know that simply 10.0.2.2 is working well on the android AVD but I've no idea about real devices.
I'm using Microsoft Internet Information Services (IIS) as my server and the web application is also running well. I don't know whether the firewall is blocking the port or not.
This should work:
Unplug all the network cables on the computer and turn off your wifi.
Turn off the wifi on your Xperia.
Connect your Xperia to your computer via USB Turn on "USB Tethering" in the android menu. (Under networks-> more...-> Tethering and portable hotspot")
Get the IP of your computer that has been assigned by the USB
tether cable. (open command prompt and type "ipconfig" then look
for the IP that the USB network adapter has assigned, It is Under 'Ethernet Adapter Local Area Connection' title. The Value for the IPv4 address is the One you need.)
Open a browser on the PC using the IP address found instead of
localhost to test. i.e.
http://192.168.1.1/myWebSite
Open a browser on the android and it should work.
If it is working on your PC but not in your device, You have to allow your http through firewall.
Follow How to enable sharing of web site on localhost? to do it.
Is it possible to connect to ADB over bluetooth?
I am trying to test 3G data download, but want to have ability to connect to ADB without using USB. Using WiFi (local only) and 3G, as understand, will not work because Android will still use WiFi for downloads (even that WiFi is local only, no outside exit).
How can I set up connection to ADB over bluetooth to send ADB commands for Android device to execute?
I have seen people post that they have been able to do it just like with WiFi using Bluetooth tethering. You'll need to find your IP address.