Android | WiFi adb keeps disconnecting in android studio - debugging

It was really strange that adb wifi was disconnecting and debugging via cable is way more unreliable as well as uncomfortable.I did research on internet too. I did try many possible solutions, changing adb drivers, wifi mode and etc. But can't find the problem. It's just keeps disconnecting. I tried to make a loop to keep alive the adb connection.
:loop
adb connect 10.226.170.129:4444
goto loop
But, still didn't work. Even after running this loop infinitely it still disconnected.

WiFi adb is great tool to debug wirelessly. But, there can be many problems to face. So, try this guideline.
The procedure is below.
connect device to computer
execute this command : adb devices
You should see the device name.
if not then
Update adb drivers. click here...
else
execute this command : adb tcpip 4444
Here 4444 is a port number which can be replaced with any 4 digit number.
5. remove the device from usb port.
6. execute this command : adb connect IP of your device: port num
Ip can be anything. It can be found under about section of your device and port number is 4 digit number.
for example I will run
...
adb connect 10.226.170.129:4444
...
Done it should be connected now.
if your device is going offline often. That means there are some things to check.
run kill adb-server and then start adb-server. Then follow the procedure.
run adb shell setprop service.adb.tcp.port 4444 before adb tcpip 4444.
Check If networking options are enabled in developer mode. If any wifi related or tethering related options are enabled then disable it.
Some times some devices disconnects adb if screen is locked. So, try to keep display unlocked.
some devices only supports wifi adb in charge only mode. So, try to change it under usb configuration.
Some devices only supports adb in MTP protocol. So, after connecting cable choose MTP or file transfer.
try to run a loop mentioned above.
Hope this works.
REFERENCES
adb wifi often go offline, how to keep adb online?
Android ADB device offline, can't issue commands
Adb over wifi killed off after usb disconnect?
ADB over WiFi connection is lost after disconnecting USB
https://android.stackexchange.com/questions/116597/adb-wi-fi-connection-disconnects-when-device-goes-to-sleep-in-moto-g-2014
How can I connect to Android with ADB over TCP?

Related

Using Putty to connect to a Cisco 4010 via built in usb port results in error 1450. Using windows 10 build 19044

I'm attempting to connect to a Cisco 4010 network switch via it's built in usb port (which internally is a usb to rs232 adapter wired to the back of the console port).
I have installed the Cisco usb console drivers version 3.1
When I plug into the usb port, the little green LED that indicates that the console port has switched to usb does not light up.
When I run putty, and attempt to connect via serial connection to COM16 (the usb to rs232 in the cisco switch) I get:
Unable to open connection to COM16
Opening '\.\COM16': Error 1450: Insufficient System resources exist to complete the requested service.
I have tried reinstalling the drivers to no effect.
I have 3 identical switches, which give me identical behaviour, all 3 new out of the box with no programming.
Changing the Baud rate makes no difference, not that I'm expecting it to as the issue seems to be COM16 doesn't exist or similar
Putty Settings and Device Manager
With the help of a colleague, we narrowed the issue down to windows using a default usb to rs232 driver rather than the cisco one I had installed. The big clue came when I tried using putty inside a VM and it worked, while on the host OS I was still getting error 1450.
We had to compeletely uninstall all drivers, reboot, reinstall drivers manually, reboot, then attempt the usb connection again.
The last comment here describes it:
https://community.cisco.com/t5/cisco-software-discussions/usb-console-cable/td-p/3952600
I will copy the solution across to here, for easier search of the solution for the next person who has the same issue.
For WIn10 , install the setup(x64).exe from the Cisco_usbconsole_driver_3_1.zip.
Check that the Cisco Serial (Comx) is using the correct driver provider which should be Cisco. Don't use the Cypress driver.
Device Manager
To update the driver,
If you installed it already and having issues, uninstall it using the setup(x64),exe then reboot PC.
Uninstall Cisco Driver
First, disconnect the blue Cisco USB console cable. Reinstall the Cisco USB console drive using setup(x64).exe from the Windows_64 folder which was extracted from file Cisco_usbconsole_driver_3_1.zip.
Reboot PC
Open device manager to observe the driver installation. Check that you see "Cisco USB to Serial Adapter". If you don't see it repeat the above steps.
if you see above "Cisco USB to Serial Adapter". then
Update Driver
Click UPDATE DRIVER, then Browse my computer for driver software.
Choose " Let me pick from a list of available driers on my Computer." Select "Cisco Serial".
Pick driver
Finally,. connect to the COM port x indicated in the Device Manager, Ports (COM & LPT) , Cisco Serial (COMx)

Coral Dev Board "mdt devices" can't find any devices

I was following the Coral Dev Board get started guide - Get started with the Dev Board (https://coral.withgoogle.com/docs/dev-board/get-started/). Everything worked fine until to the step - Connect to the board's shell via MDT.
I've waited about 5 minutes until the flashing to complete, and the terminal prompt returned to me, then I tried the command:
mdt devices
The terminal returns nothing. Unlike the guide says it supposes to return my board hostname and IP address. I've checked the USB-C OTG and USB-C power cable, they are all connected well.
I've also tried this solution: https://superuser.com/questions/1452786/coral-dev-board-not-recongized-on-mdt-shell. I went to Network under System Preferences, and clicked "+" icon, but I couldn't find the mendel device.
I'm using Macbook Pro running on macOS Catalina. The fastboot and mdt commands are both working.
I just found a solution:
Just plug micro-B USB cable, then run:
screen /dev/cu.SLAB_USBtoUART 115200
If it shows blank, wait a couple seconds, then plug usb-c power cable, the system of the dev board will start loading, the login prompt will come out. After I logged in, I plugged the usb-c cable into data port(keep the micro-B USB cable in at the same time), then run:
mdt devices
or
mdt shell
This solution works for me only when I have turned on the wifi of the dev board and connect it to the same wifi network. If you want to turn on the wifi network of coral dev board, run the command on screen terminal:
nmtui
The Network Manager TUI prompt will come out then you can connect to your wifi network.
It's a problem on macOS Catalina. It doesn't "see" USB connection as a network connection and as such it is impossible to connect to Coral Dev Board.
I have the same issue, but I tried with another MAC with older macOS and it worked just fine.
Now, I don't have yet the solution, but at least we all know the problem ;-)
Regards,
Rui
First check the that the device is detected by running dmesg command.
Normally you should see something like this
$ dmesg
...
[107834.681816] usb 2-3: new high-speed USB device number 3 using xhci_hcd
[107834.845073] usb 2-3: New USB device found, idVendor=18d1, idProduct=9304, bcdDevice= 4.19
[107834.845077] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[107834.845079] usb 2-3: Product: Mendel
[107834.845081] usb 2-3: Manufacturer: Google,LLC
[107834.845083] usb 2-3: SerialNumber: bored-horse
[107834.985296] cdc_acm 2-3:1.0: ttyACM0: USB ACM device
[107834.986069] usbcore: registered new interface driver cdc_acm
[107834.986070] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[107835.005045] cdc_ether 2-3:1.2 usb0: register 'cdc_ether' at usb-0000:06:00.3-3, CDC Ethernet Device, aa:9f:04:54:dc:45
[107835.005124] usbcore: registered new interface driver cdc_ether
[107835.019787] cdc_ether 2-3:1.2 enxaa9f0454dc45: renamed from usb0
[107897.336866] IPv6: MLD: clamping QRV from 1 to 2!
[107956.344960] usb 2-3: USB disconnect, device number 3
[107956.345357] cdc_ether 2-3:1.2 enxaa9f0454dc45: unregister 'cdc_ether' usb-0000:06:00.3-3, CDC Ethernet Device
...
After that, check your network interfaces using ip command
$ ip link
Then look for the one with the one with the same MAC address as the one that appears in the logs of dmesg.
Once you find it, run this command to assign an IP address
$ sudo dhclient <name of the network interface of coral dev board>
Now you should see an IP assigned to the interface.
$ ip a
After that, run mdt devices and you should see the dev board connected.
$ mdt devices
bored-horse (192.168.100.2)
I had the same problem in Debian (Buster). I was able to follow all the steps to connect and flash the device until 'mdt shell' and I would receive a 'Unable to find any devices on your local network segment' message.
Opening the network settings and enabling 'USB' as a network interface worked for me.
After connecting to the Coral Dev Board the first time and exchanging private keys, I unplugged the USB cable. After that, my computer was offline until I re-enabled the ethernet connection. It seems that enabling the USB network disabled the ethernet. At that point, mdt shell was able to connect via the ethernet network.
So I've just spent most of the afternoon with this issue. After I downgraded the OS to Chef it seemed to work fine as the USB device (OTG port) would initialize on boot and then the SSH key could be pushed through. However, with the latest OS (Eagle) this was not the case.
The fix was simple:
Remove the USB C OTG port cable from the board
Reboot the Coral board
Wait for boot sequence to complete
Connect the USB C OTG port cable to the board
Run "mdt shell"
key is pushed through!
Now I can set up the WiFi or connect Ethernet and remove that cable once again and now I can freely call mdt shell and it connects every time.

Why does the NativeScript CLI command 'tns devices' just hang?

e.g.
tns devices android
Gives me:
C:\Users\Matthew>tns devices android
Connected devices & emulators
Searching for devices...
[hangs here till I Ctrl+C]
Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again.
Terminate batch job (Y/N)?
My device is visible in windows, a HTC One M9, and the drivers for it are installed. The device is in 'dev' mode and the USB debugging is switching on, and shows up as a warning notication.
SideKick shows no connected devices either. Although I suspect it's using the same back end that the tns command uses.
'tns doctor' says everything is good. I can build apps locally.
I had a number of active adb.exe processes. And it seems they were in a bad state somehow. Closing any one of them didn't result in progress but if I closed the whole process tree with Process Explorer then:
adb devices
Would actually list without hanging.

Debug without handheld

I was trying to debug over Bluetooth but I was getting the localhost:4444 offline issue...
So I went and erased all data from google play services. After that, my watch was forgotten by my handheld...
I have some important files on my watch that I NEED TO KEEP...
Is there any way of connecting the watch via adb WITHOU THE HANDHELD???
Allready tried tcpip connection but adb was unnable to connnect to the ip of my watch
ps: My watch is a Moto 360 sport (no cable connection)
No, for a watch without a cable connection, there's no way to connect adb without some sort of proxy through the handheld. It is possible to connect adb over Wifi, but you need another adb connection first to get that started (AFAIK) - which brings you back to the BT-via-handheld connection.
There's no reason why you should need to be clearing data from Play Services on a regular basis - but as you discovered, that's where Android Wear keeps its data about the phone-watch connection. So if you don't want to factory-reset your watch, don't do that.
The reality is that adb to Wear is just incredibly painful over Bluetooth, making a watch like the 360 a bad choice as a development device. I'd suggest doing as much debugging as you can using the emulators, and if you can afford it, get another watch with a hardwired connection. You can pick up a secondhand ZenWatch or G Watch R pretty cheap these days.

Cant log in to BeagleBone Black's SSH through my Mac?

I am new to the BeagleBone Black and I have so far been unable to connect the BeagleBone with my Mac and successfully log in to SSH.
I have downloaded and installed both HoRNDIS and FTDI_ser but this has not helped.
I have also allowed remote log in's through my Macs network preferences.
The connection I am attempting to make is with an Ethernet connector and uses an Ethernet to USB adapter.
When I try ssh root#192.168.7.2 through my terminal the connection is just timing out.
Can anyone suggest something else I could try or what might be preventing the connection?
I'm not sure how a Ethernet to USB adapter works but using the plain USB adapter that comes with the BeagleBone Black, after installing the above mentioned drivers, you need to restart the Mac and then try opening http://192.168.7.2 or ssh root#192.168.7.2
I know this is an old post that I am responding to but for others who may be having same problem.....First off, if you installed all drivers and when you plug in USB to your Mac and the BBB does not show up as a removable drive then try the steps below. If it does, then type ls /dev/tty.* in your terminal and look for an output on the terminal tty.USB0. Then serial connect to that tty. If all else fails try this failproof method for serial connecting to BBB
Get USB to UART debug connector find it on Amazon here
Install the CP2102 drivers for Mac
Type ls /dev/tty.* on terminal (of course have it connected to Mac
Your terminal should output a device named tty.SLAB_USBtoUART
Serial connect to that tty name with a baud rate of 115200
Power your BBB (you can use the USB connector that comes with BBB to power it on, so you should have one USB connected for powering the BBB and the other is the debug connector connected to your mac for a serial connect.
Bam! You should see Uboot output and a prompt to login

Resources