Reboot offline Android device remotely

Matthias Braun picture Matthias Braun · Sep 6, 2011 · Viewed 8.9k times · Source

I would like to reboot a connected but offline Motorola Droid 2 device via ADB (or monkeyrunner). Restarting ADB via adb kill-server and then adb devices has not brought the device back online. So I figure I have to restart it. How can I do a reboot without walking over to the offline device?

Here is what I have tried until now:

  • adb reboot
  • adb shell start
  • adb remount

All those command yielded the same error message: error: device offline

The device is running 2.2, it's in charge only mode and debugging is enabled.

Many thanks in advance

Answer

Kurru picture Kurru · Sep 7, 2011

Most likely you'll be testing your application on the device, including UI so a good option is to have the device nearby, though this is not true for unit test development.

Unfortunately the issue you have come across is very common when testing on a device, and the best solutions are:

  1. disconnect the device and reconnect it
  2. restart the adb server
  3. disconnect the device and reconnect it again
  4. restart the device physically

As far as I am aware, because adb is unable to discover your device, it is unable to communicate with it also, so your current approach with using ADB to restart it won't get you very far.

A more complicated solution would be to install a service application which monitors for a "restart" instruction from an online source. Then use a solution from here to reboot.