Android ADB device offline, can't issue commands

可紊 提交于 2019-12-17 02:53:15

问题


I can't connect to my device anymore using ADB through the command line or in Eclipse.

Running the command

adb devices

returns the device name, but it says it's offline.

Things I've tried.

  1. Toggled Android debugging mode
  2. Reinstalled the Google USB driver
  3. Restored the OS to a previously working backup (CyanogenMod)
  4. Swapped the USB cord
  5. Rebooted the phone/computer multiple times
  6. Updated the Android SDK

I really don't have any clue what's going on. Anything else you think I can try, I'm all ears.

To be clear, if you're having this same issue the problem is probably an out-of-date SDK. As of 4.2.2 there is a security feature that requires you to confirm the RSA fingerprint of the connecting device. Open the SDK manager and update the tools! Then reboot.


回答1:


I just got the same problem today after my Nexus 7 and Galaxy Nexus were updated to Android 4.2.2.

The thing that fixed it for me was to upgrade the SDK platform-tools to r16.0.1. For me, this version was not displayed in my SDK Manager, so I pulled it down from http://dl.google.com/android/repository/platform-tools_r16.0.1-windows.zip directly.

You then need to rename the platform-tools directory and unzip it to android-sdk-windows/platform-tools. Using the SDK Manager, I had also updated to the latest sdk-tools before this.

If your whole Eclipse and ADT are ancient, you may need to update them as well, but I didn't need to.

Note: you may need to run SDK Manager twice (once to update itself) before you will see the latest packages.




回答2:


Try running adb devices after running adb kill-server. Security question pops up after that. Worked for me.




回答3:


It also seems to occur frequently when you connect to the device using the Wi-Fi mode (in Android Studio or in the console by running adb tcpip 5555 for example).

To fix:

  1. Disconnect the USB connection—or turn off the device's Wi-Fi if you're connected over Wi-Fi.
  2. Close Android Studio/Eclipse/other IDE.
  3. Run adb kill-server to ensure adb is not running.
  4. Restart your Android device.
  5. After your device restarts, connect it via USB and run adb devices. This should start the ADB daemon. Your device should now be online again.



回答4:


I hit the same issue on a Nexus 7 running 4.2.2 OTA update. I'm almost certain I had an ADB connection over USB and Wi-Fi after the update until it just stopped working. To fix, I updated my SDK using:

android update sdk --no-ui

Now my development tools are:

  • SDK rev 16.0.2
  • SDK tools rev 21.1
  • SDK API 17, rev 2



回答5:


For anyone wondering about 4.2.2, there is a security question that appears on the phone requesting RSA verification with the PC. Be sure your tools are updated AND you allow the PC access by verifying the security question on the devices in question. This fixed it for me.

And as always, verify you have debugging enabled in the developer options ;)




回答6:


I can't stress that switching USB ports is key. Often front panel USB ports can be defective.




回答7:


Multiple adb.exe files ?

My problem was solved when deleted a copy of OLD adb.exe from C:/Windows/. I don't know how a copy of adb.exe got to the C:\Windows\ ?

When I launch adb.exe from android-sdk/platform-tools/ I had no problem with detection.




回答8:


Try by turning off usb debugging once and then enabling it agin and then connect your device with system: link




回答9:


I was having this problem and none of the other answers helped. What was necessary, after updating the SDK and installing the API for 4.2.2, was running:

android update adb

Another problem I was having was that I was trying to connect ADB over Wi-Fi, which is my only option because the USB ports on my Mac are really finnicky. Unfortunately, ADB over Wi-Fi doesn't show the security question in 4.2.2, so you need to find a USB cable that'll work and connect over USB at least once to accept the security question, but after you do that once, you can connect over Wi-Fi.




回答10:


If your device normally connects over USB, but suddenly stops working, especially after the USB cable has been disconnected and reconnected, try the following non-invasive steps before doing some of the more drastic things mentioned in the other answers:

adb kill-server
adb start-server
adb devices

If your device is listed with 'device' next to it, you're back in business.

If your device is listed with 'offline' next to it, try restarting the device. The ADB daemon on the device will occasionally get hung. I've noticed this more when I've disconnected the cable while LogCat is running and after switching back from connecting via Wi-Fi or Ethernet.

If your device isn't listed then you should try the solutions in the other answers, starting with trying a different USB cable and port. Those cheapo cables can go bad.




回答11:


Be sure to use adb from your platform-tools folder, after updating the SDK tools.

I finally got this working after I realized I was using an outdated version of ADB copied in /usr/bin.




回答12:


Sometime this may happen because of adb server error (i think). It always saying

"device-name is offline" from adb devices command.

Just kill server and start again. It worked for me.

"adb kill-server"
"adb start-server"



回答13:


I used adb connect <device_ip> and non of the other solutions worked because my problem was on the other side. On the device I needed to stop adbd and restart it start adbd. Device is now "online" again.




回答14:


I ran to through same problem this fixed for me. connect your phone via usb first then make sure you check your mobile ip which is under settings >> about phone >> status run the following commands.


adb kill-server
adb start-server
adb tcpip 5555 //it resets port so put port you want to connect
adb connect 192.168.1.30:5555 //ip:port of your mobile to connect
adb devices //you will be connected over wifi




回答15:


I tried dturvene and all the other solutions, but they didn't work. I needed one more step.

Run these commands

  1. adb kill-server
  2. android update sdk --no-ui
  3. adb start-server

To verify that it worked, run 'adb version' before and after the commands and make sure it is the latest. The reason for the adb kill-server command is that it it most likely running, and it can't be updated while it is running, so you have to kill it first.




回答16:


For me nothing worked. I spent about 12 hours constantly searching on the Internet and trying the solutions that worked for other people having similar issues.

Finally I ended up with just doing the ADB stuff over the LAN. The setting was right next to the USB Debug setting and in ADB it can be activated with "adb connect [IPADDRESS]:[PORT]". The port was 5555 on my phone.

I hope this helps someone to get back to work instead of having to deal with constant drawbacks.




回答17:


This approach worked for me:

  1. adb kill-server
  2. Disable the offline device in Device Manager (see image below)
  3. Enable the device in Device Manager
  4. adb start-server

Device Manager, "View" menu, "Devices by Connection":




回答18:


I initially encountered the same problem (with ADB/fastboot downloaded from GitHub), but I eventually got it to work. What worked for me:

  • Android SDK. ADB version: 1.0.31
  • Using the front USB port (MacBook Pro 15")
  • Restarting the phone after enabling Dev options and USB debugging (do so by 7x tap on settings > about phone > build).
  • Kill adb server in case no device is listed (adb kill-server)
  • The debug icon should be visible on the phone.
  • Be sure to unlock lock-screen to check for the RSA fingerprint confirmation dialog.



回答19:


Installed the latest android sdk.
Changed the USB port of the device.
Changed from MTP -> Charge only -> MTP.
It worked.




回答20:


If you've previously authorized the RSA fingerprint of your PC and tried adb kill-server etc. with no luck, your problem might just be that you're trying to connect to it while it's locked. Try pressing the screen-on button and entering your pattern - this fixed it for me.




回答21:


The best way I figured is by disabling and then enabling the device from Device Manager and running the adb devices command.

  1. Go to the start tab and right click on Computer
  2. From the drop down menu, click Manage
  3. From the computer management screen, click Device Manager
  4. On the right pane, expand portable devices to find your device
  5. Right click on your device name and click disable on the drop down menu
  6. When it gets disabled, repeat step 5 except for enabling it.

The device will be back online. It's faster.




回答22:


One more possibility for people with flaky ADB connections, and if they're on a Mac and have Android File Transfer installed: I found that file transfer was interfering with my ADB connection, causing it to stop working intermittently.

Killing the Android File Transfer Agent.app process that looks for compatible devices (for example, the Nexus 7) being connected to the Mac cures the flakiness for me.




回答23:


As nobody gave an answer for my situation: you may not have access to the ~/.android/adbkey file. If you initially start adb with sudo, it will generate a public key pair, writing this to ~/.android/adbkey.pub and ~/android/adbkey. Of course, the private key is chmod 600 - only readable for root in your home directory. Subsequently starting adb as normal user will give no access to the private key file, which in turn will fail silently with "device offline".




回答24:


What solved for me on Mac was updating adb to the latest version (1.0.32). Now i can see my device online again




回答25:


The reason for a device to be reported as offline is that adb can not connect to it. Adb executable from the development environment creates a connection (socket) with the device under control. The device has a service (daemon) that listens for this communication. The daemon is called adbd (as in adbdaemon). When one enables adb on a device in fact one starts this daemon, so comms can be established with the device.

When the device is reported by adb as offline is because the daemon is not running anymore or is in a state that will not accept connections. Most often than not this happens if the network goes down on an active (network) connection.

The only way that I could fix this was by rebooting the device. One can arrive to fixing the offline status by many other means but restarting the device always works.




回答26:


It's just because your computer doesn't have the right driver. To fix that:

  1. Download and extract Android SDK

  2. Go to Device Manager (Right Click on Computer --> Properties --> Device Manager

  3. On the right pane expand portable devices to find your device

  4. Right click on your device name and click Update Driver Software

  5. Browse my computer for driver software

  6. Browse to your Android SDK folder on step 1.

  7. Next and you're done




回答27:


Try to restart the adb server as follows:

adb kill-server

adb start-server

I have also came across the same problems as yours. And restarting the adb server will resolve this problem.




回答28:


I updated many times, until I couldn't update any more, but I never got a prompt on my screen; I just kept getting the device offline.

My problem was that I was running the ADB command from a different directory to what was actually being updated.

The correct updated directory for the ADB exe is:

C:\Program Files (x86)\Android\android-sdk\platform-tools\



回答29:


Restart the device. I tried everything listed here to get my HTC phone (running Android 4.0.3) working, but adb devices kept saying it was offline. After I restarted the phone, it was finally online. Some of the other suggestions here may have contributed to the phone being recognized, but doing a few restarts along the way as you're trying them out certainly won't hurt.




回答30:


late but I found the easiest way just go to DDMS and follow as shown in image...



来源:https://stackoverflow.com/questions/14993855/android-adb-device-offline-cant-issue-commands

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!