- Android Studio — Device is connected but ‘offline’
- 31 Answers 31
- adb wifi often go offline, how to keep adb online?
- 7 Answers 7
- Q1. adb service often crashes if it is not doing any executions for a long long time.
- Q2. wifi connected device sometimes disconnect.
- Q3. wifi connected device is sometimes offline.
- VS Web School
- ADB constantly disconnects, shows device offline
- How to Fix ADB Device Offline Error: Detailed Guide
- How to Fix ADB Device Offline Error
- About Chief Editor
- Sadique Hassan
Android Studio — Device is connected but ‘offline’
I have tried it on a separate machine that runs fedora and this works fine with no issues, the promopt appears right away. Therefore I imagine it is not the USB cable that is faulty.
I hate android studio. For no reasons it suddenly started to show me this when my device was surely connected.
31 Answers 31
- Unplug and replug the USB cable.
- If it still doesn’t work, unplug the USB cable, disable then enable USB debugging in the device settings.
- If the above two methods fail, reboot the device.
- If rebooting the device also fails, reboot Android Studio too.
- If reboot Android Studio still fail, try adb kill-server then adb start-server .
I just wonder why such heavily used and basic feature, made by one of the biggest developer (Google) is so unstable?
@PolGraphic its not google, but the companies that build the phones’ hardware. Google made the OS, but its up to manufacturers to have compatible chips that can work with the OS.
Try killing adb adb kill-server then disable usb debugging and then start adb by adb start-server then enable usb debugging and plug phone again and huh don’t let phone sleep between process
There turned out to be a problem with my laptop’s ADB RSA key. I’m assuming my G3 was rejecting a bad key and disallowing my laptop to connect to it via ADB.
ADB saves a key file in one of multiple places on a Windows computer, the first is in the location where adb.exe is (C:\android), the second is in the user’s >profile (C:\Users*username*.android), the third place is in the Windows system files (C:\Windows\System32\config\systemprofile.android), the file is >simply named «adbkey» with no extension. If there is no key file when ADB runs, it will generate one automatically.
Mine was located in my user folder (C:\Users*username*.android). All I had to do was delete the adbkey file (there was also a file named «adbkey.pub» which >I deleted as well), restart the adb server in command prompt (adb start-server) and plug my phone in. I instantly received the RSA Fingerprint Key window on my >G3 allowing connection between the two devices. Then typing «adb devices» returned my phone’s serial number followed by «device» showing it was available. >I went back to the C:\Users*username*.android\ folder and sure enought there were new «adbkey» and «adbkey.pub» files.
- Navigate to where .android is stored
- open .android and delete file named as adbkey and adbkey.pub
- Start ADB then type adb kill-server and adb start-server
adb wifi often go offline, how to keep adb online?
I’m using Android tablet communicating with a USB device through USB port, the tablet only has one usb port, so I use adb wifi as my debug tool. However, when I connect adb through WIFI, the connection won’t keep long(only a few minutes us usually), how to keep the adb wifi connection online all the time? Another question, is it possible to use USB HUB to connect the tablet with both USB flash-drive and my computer, and keep adb running? Many thanks.
7 Answers 7
After lots of unsuccessful attempts,I have noticed that turning Allow ADB debugging in charge only mode specification on , solved the problem . It makes the device online and accessable over wifi to ADB. You can find it under Developer options section.
Here is what I found out from researching everywhere and developing on my own for more than a week.
Q1. adb service often crashes if it is not doing any executions for a long long time.
A1. calling adb commands time to time keeps adb server online.
Q2. wifi connected device sometimes disconnect.
A2. Before you check your wifi on the connected device, check the wifi that your ADB server is running on. Ping to google and if it is well connected, ping to the device.
Wireless can disconnect on its own and even wired connection is sometimes disconnected. so calling «adb connect . » when the device is not already connected is necessary. You could do this easily by saving «adb devices > device.txt» and query out whether your expected wifi is on the list. If not, connect again..(do this in another thread).
Q3. wifi connected device is sometimes offline.
A3. This is because by TCP/IP connection your ADB server is now on Time_Wait stance. The last connection was interrupted that the next connection is now offline because the last connection is not completely shut down. You can either manually disconnect/connect your device’s wifi or restart TCPIP connection by ex) «adb tcpip 5555» If you want to do this automatically, you are going to have to disconnect/connect your device’s wifi programmatically.
VS Web School
Выполните следующую команду :
~$ android update adb
*************************************************************************
The «android» command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
b) Перейдите к «Development options» в настройках вашего телефона и нажмите «Revoke USB debugging authoriz..» Как активировать «Development options» читаем тут
1. Отключите и снова подключите USB кабель к вашему ПК
Выполните следующую команду :
~$ adb devices
List of devices attached
0123456789ABCDEF device
1. Отключите USB кабель
2. Отключите и снова подключите ваш телефон через Wi-Fi
Выполните следующие команды :
~$ adb connect 192.168.1.52:5555
~$ adb disconnect 192.168.1.52:5555
3. Перезагрузите adb на вашем компьютере
Выполните следующие команды :
~$ adb kill-server
~$ adb start-server
4. Перезагрузите ваш телефон и снова подключите его через USB
~$ adb devices
List of devices attached
0123456789ABCDEF device
1. Отсоедините USB кабель от ПК и от телефона. Перейдите к «Development options» в настройках уберите галочку с «Android debugging»
и снова поставьте.
2. Снова подключите ваш телефон через USB к вашему ПК, вы должны увидеть всплывающее окно. У вас спросят хотите ли вы использовать USB соединение для отладки. Ставим галочку и жмем «OK».
ADB constantly disconnects, shows device offline
I’m not 100% sure if this should go here or the main Stack Overflow, but I decided to go with this area in hope I might catch someone with more specific experience with a similar problem. I have a Samsung Captivate (love it minus it’s crappy GPS). I do development for it from 2 different computers, one at home, one at work. The machines are both Windows XP, Service Pack 3, 32 bit. I have the same Samsung drivers installed, same versions of Eclipse, etc. The phone is currently rooted running the Serendipity mod, though this issue was exactly the same on the stock firmware. My home machine (the problem one) is an Athlon 64 2.2 Ghz. My work machine is a Core 2 Duo, don’t recall the model. At work, I can do anything, mount the sdcard on the phone and copy easily, use adb to push, pull, uninstall, install. I can debug in ddms, install through Eclipse, etc, etc. At home, if I reboot both the computer and phone and pull up a command prompt without having Eclipse open, I MIGHT be able to see the device by typing adb devices. Usually then, I can clear the logcat or run the logcat fairly stable. If I open Eclispe (my development IDE) and try to run a new build of an app, I’ll generally lose the connection. The same thing happens if I try to copy files either via mounting or using pull with adb. Some files will copy, and suddenly the connection will be gone and the device will show offline to adb, or not in the list at all, or listed offline twice. Rebooting the phone sometimes helps, but not always. There are times I close Eclipse and every other app, reboot my phone and still end up having adb completely unable to detect the device. I’ll use adb kill-server and adb start-server but this generally doesn’t help. I use Avast for my anti-virus at home, but have tried without any anti-virus installed at all and it’s the same. I’ve recently reinstalled Windows due to a hard drive crash and it was the exact same. I’ve tried every different USB port on my tower. I hope VERY much someone can tell me what’s wrong as I’ve been dealing with this for a year and a half now and it’s about to make me lose my mind. -Jeremiah
When I detach and reattach my usb cable, the problem goes away. Don’t know if this is a cable problem or some kind of timeout problem. Any clues ?
My USB cable that shipped with the device is notorious for this problem when debugging. Charging is fine though. Anyway, I swapped to my old (and incidentally shorter) USB cable and now it’s working.
Same issue with Pixel 2 and Macbook Pro 15 inch 2018. My USB C to USB type C cable is the original one from Google
How to Fix ADB Device Offline Error: Detailed Guide
In this guide, we will show you various methods to fix the ADB device offline error. ADB and Fastboot commands are perhaps the most powerful tools that tech enthusiasts could have at their disposal. If we keep our focus on ADB, then its functionality is spread across both the basic and advanced domains. The basic tasks involve booting your device to recovery (stock or TWRP), rebooting to Fastboot or Bootloader Mode.
Then the advanced functionality usually involves unlocking/re-enabling the device’s features that have been disabled by the OEM. In this regard, recently I was trying to bring back the WiFi toggle on my Android 12 device which Google has removed from the stock OS. For that, I just needed to execute a single line of command and the task would have been complete. However, it proved to be easier said than done. Every time I executed the ADB command, it gave out the device offline error.
But in all of this, there was one interesting thing that I noticed- the command prompt was still able to identify the device ID upon executing the adb devices command. So my first course of action was that there might be something wrong with the device. So I re-enabled USB debugging/switched to a different cable and tried other such tweaks, but was still getting the same ADB Device Offline error. Just to tinker a little bit, I tried executing another command to boot my device to Fastboot Mode. But still got the same error.
So this made me sure that the issue is with the PC itself. To double-check, I switched over to a different Android device and again got this error, but this time I noticed something interesting- it was still displaying the same device ID as what was shown for my first device. This isn’t possible since two devices cannot have the same ID. Well, the weirdest part was the fact that even when no device was connected it still showed the device ID.
So all this made perfect sense now- the ADB window wasn’t even checking the status of the device in the first place. Whatever cached values were saved, it just displayed that- irrespective of the device connected. Now that I got hold of the reason behind this issue, the fix was relatively easy to execute. And yes, it worked out on the first try itself. So without further ado, let’s check out the steps to fix the ADB device offline error. Follow along.
How to Fix ADB Device Offline Error
Before starting off, there are a couple of things to keep in mind. First off, it is recommended to use the official USB cable that came with your device. Along with that, you should also consider using the USB 2.0 Port instead of the 3.0 port as the latter isn’t known to work well in the ADB and Fastboot environment. Once you have checked marked both these requirements, you may then proceed ahead with the below steps to fix the ADB device offline error.
- To begin with, download the Android SDK Platform Tools and extract it to any convenient location on your PC. Doing so will give you the platform-tools folder, which will be used throughout this guide.
- Next up, enable USB Debugging so that your device is recognizable by the PC in ADB mode. So head over to Settings > About Phone > Tap on Build Number 7 times > Go back to Settings > System > Advanced > Developer Options > Enable USB Debugging.
- Then head over to the platform-tools folder address bar, type in CMD, and hit Enter. This will launch the Command Prompt.
- Now type in the below command to kill the ADB Server:
That’s it. These were the steps to fix the ADB device offline error. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.
About Chief Editor
Sadique Hassan
A technical geek by birth, he always has a keen interest in the Android platform right since the birth of the HTC Dream. The open-source environment always seems to intrigue him with the plethora of options available at his fingertips. “MBA by profession, blogger by choice!”