What does adb device status mean? - android-studio

I am getting the message adb device status:offline in my terminal of Android Studio. What does this mean ?
I have one android virtual device as my emulator. My emulator is working fine. And it is also connecting to the internet since maps are getting loaded. So is this gonna affect anything ?

This is described in the adb documentation:
State — The connection state of the instance may be one of the following:
offline — the instance is not connected to adb or is not responding.
device — the instance is now connected to the adb server. Note that this state does not imply that the Android system is fully booted and operational, since the instance connects to adb while the system is still booting. However, after boot-up, this is the normal operational state of an emulator/device instance.
no device — there is no emulator/device connected.
So if your device is listed as offline it might affect your ability to communicate with it via adb - e.g. to collect logs. It's not an inidcator of the device's internet connection status.

The adb documentation says that there are 3 connection states: offline, device, and no device, but there are actually a few more connection states that the device can be in. You can see this in the adb header file on line 174.
From the adb documentation:
offline - the instance is not connected to adb or is not responding.
device - the instance is now connected to the adb server. Note that this state does not imply that the Android system is fully booted and operational, since the instance connects to adb while the system is still booting. However, after boot-up, this is the normal operational state of an emulator/device instance.
no device - there is no emulator/device connected.
Some other states:
recovery - Your device is in recovery mode. This mode is used to recover your phone when it is broken or to install custom roms.
sideload - Your device is in sideload mode and can accept adb sideload commands. This mode is used to push and flash zip file images to the device and is accessed through recovery mode.
unauthorized - The adb host's RSA public key has not been added to the device. This happens when you haven't clicked allow on the Allow usb debugging? dialog on the device.
no permissions - Insufficient permissions to communicate with the device.
host - I haven't found any good explanation of what this state is.

Related

Wi-Fi Debug (ADB) - There was an error pairing the device

When I first update to new version of studio I tried to use this new WiFi debug feature and it was working at first time (using QR code or manually typing the code) but now it's stuck with "Connecting to device. This takes up to 2 minutes." message for some time and then I get "There was an error pairing the device" message. Before it would take a couple of seconds to connect. My device is Samsung S10 (12 Android)
EDIT 2: Take a look at the below answers, the actual reason seems to be that the device is assigned a random IP or a MAC via DHCP, if you can disable that via system settings for your specific custom ROM, then it's even better
EDIT: If you see regular disconnections, click on `Pair Device with Pairing Code`, and then pair your device with the following command
adb pair <ip-addr>:<port> <pairing_code>
I was facing the same issue, what I did was switching to the command line way of connecting with the device. You can do so in the following way
Make sure USB Debugging is enabled on the device you intend to connect with
In your device, go to Developer Settings>Wireless Debugging and you will see something like so
Now carefully look at the IP ADDRESS AND PORT section and type the following in the terminal
adb connect <ip-addr>:<port>
And your computer will show under paired devices like the above screenshot
I was able to resolve the issue from within Wi-Fi settings by disabling the Randomized MAC Address feature under Privacy. Using my device's actual MAC address fixes the issue.
I had the same problem but I managed to find the solution.
You have to follow the following steps:
In your smartphone (Go to Settings->Developer options-> Wireless Debugging->Pair device with pairing code).
Copy the ipaddress & port.
For example: 192.168.1.2:42123
and wifi pairing code: 234321.
Open your terminal and go to the following path:
cd %LOCALAPPDATA%/Android/sdk/platform-tools
Paste the following command following this order:
adb pair (ipaddress & port that you saw when you clicked on "Pair device with pairing code")
abd pair 192.168.1.2:42123
Paste the access code to the wifi connection.
Enter pairing code: 41107.
Finally, on the same screen go to the option that says IP address and port and you
will see the same address but with another port (You can find it in this part of your screen), copy it and write the following
command:
adb connect 192.168.1.2:41107
If you see a message like this "connected to 192.168.1.2:41107", you did it you will be able to connect your phone with android studio without any problem.
I fixed it by manually assigning IP addresses for my smartphone and PC at settings of the router. Basically avoiding DHCP.
Restarted the router.
Cleared old pairing.
Started pairing again and now it works fine all the time, and no need to repeat pairing process, just enabling "Wireless debugging" from notification panel and in couple of seconds the device will be available in Android Studio
So next time just enable "Wireless debugging" and it's ready
I don't know why there the issue with dynamic IPs
This worked for me:
Tools --> Troubleshoot Device Connections
Press Next --> Next
Click 'Restart ADB server'
Freshly turn ON Wireless Debugging on device and wait for few seconds.
Note that for me pairing wouldn't work while I was on my VPN. After I paired while off the VPN, I could adb connect ipaddress:port and it worked.

Android Device Monitor/DDMS can't connect to device over network

I am trying to debug a memory leak on a Android based VOIP desk phone with Android Studio 2.1 (For what it's worth it's a Grandstream GXV3275 phone, which has a 7in Android tablet embedded in it).
As best I can tell this device has no direct USB connection. I've enabled "Developer Mode" on the phone and am able to connect to it using "adb connect" from the command line. I can use Android Studio to then download and run/debug applications over the network.
But Android Device Monitor will not connect to the device and the phone does not show up in Device Monitor's list of devices. In the Device Monitor's console i see:
[2016-08-30 15:17:32 - DeviceMonitor] Adb connection Error:EOF
[2016-08-30 15:17:32 - DeviceMonitor] Connection attempts: 1
[2016-08-30 15:17:33 - DeviceMonitor] Connection attempts: 2
[2016-08-30 15:17:34 - DeviceMonitor] Connection attempts: 3
Any ideas how to make Device Monitor recognize devices over the network?
Well, the alternative is to use the Android Monitor tab built into Android Studio. This does indeed seem to work without a direct usb tether. Android Monitor supports initiating GC and performing heap dumps (HPROF). The downside that I have seen, is that performing an HPROF dump temporarily disconnects my ethernet connected Android desktop phone from the network.

Android 6.0 device not recognized by adb on Linux after reboot

In Samsung Galaxy S6 Edge with Android 6.0, when the device is rebooted, phone complains that the connected computer doesn't recognize the phone and the device is not any more reachable over ADB from the connected Linux PC. The phone in fact instructs user to install proper drivers for Windows or Mac OS, but as the phone is connected to Linux host, there is no help here.
This means, that in order to continue debugging over ADB, one must manually toggle the USB mode from phone from MTP to PTP, after which phone is connected through ADB again. This makes test automation impossible, as the test scheduler needs to reboot the target device between test rounds.
With previous Android versions, rebooting the device remotely and getting ADB connection back was possible, but with Android 6.0, this became a problem. This particular device had earlier Android 5.1 and there were no problems with remote reboots.
As manually toggling of USB mode solves the problem, it might help, if this mode could be automatically toggled after reboot. So far, only solutions I have seen require device rooting and that is out of question.
Does someone have any idea, how Android 6.0 device could be automatically recognized by ADB after reboot?
The solution was after all simple: the Linux user, who starts up the adb server, needed to be added to the "plugdev" group. This group was defined in file /etc/udev/rules.d/51-android.rules with line:
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
With previous Android versions, this didn't seem to be important as we didn't have any users in that group and everything worked fine.

FTDI chip detection issue

I'm trying to do some transactions over serial ftdi interface to an ARM based board. On windows i'm able to detect it but when from virtualbox i'm unable to detect the same.
When i connect the same board to a linux sever box, it gets detected and gives me the port /dev/ttyuSB0. Any idea why Virtualbox does not detect?
By default, your VMs in VirtualBox can't see any of your 'real' hardware. You can "move" a USB device from the host to the guest. (Appears as a disconnect from the host, then a connect to the guest), but it's an odd two-step process:
When the VM isn't running, create a USB "filter" on your device.
Then, when it's running, sometimes it grabs it, and sometimes you must click the USB icon (at the bottom of your running VM window, next to your disk/CD/mouse indicators).
Make sure you have a recent version of VirtualBox. I think before 4.x, the USB support was not included in the free version. But I can confirm it works in 4.1.

Make your computer discoverable

my .net app on the computer needs to make the computer discoverable, start a service and then wait to accept incoming connections. my app/computer is the slave and connecting device is the master. So I change my local radio mode to discoverable programmatically,start my service and wait... But when the device is supposed to connect to my app/computer, nothing happens.
Windows help and support has this :
Control Panel ->search for bluetooth -> click on change bluetooth settings ->
To make your computer discoverable to Bluetooth enabled devices,
select the check box for Allow Bluetooth devices to find this computer.
When a Bluetooth enabled computer is in discovery mode, it broadcasts a
wireless signal that allows it to be detected by other computers or devices.
This is sometimes called pairing mode. If you check this box, your computer
will still be able to detect Bluetooth enabled devices that are in discovery mode,
but they will not be able to detect your computer.
I am not quite sure what's the context. If I leave that box checked, then other devices will be able to detect me (because I am set to discoverable), but won't be able to connect????? So my service just keeps listening, won't be able to detect any incoming requests? Am I right?

Resources