If you’re running your application in the Android Emulator and suddenly the Hierarchy Viewer stops loading up the View Hierarchy in the standalone tool or in Android Device Monitor then chances are high that ADB server needs to be restarted in order to fix it.
You’ll get error messages like these in the console:
What's the one thing every developer wants? More screens! Enhance your coding experience with an external monitor to increase screen real estate.
12:24:36 E/hierarchyviewer: Unable to get view server version from device [emulator-serial] 12:24:36 E/hierarchyviewer: Missing forwarded port for [emulator-serial] 12:24:36 E/hierarchyviewer: Unable to get view server protocol version from device [emulator-serial] 12:24:36 E/ViewServerDevice: Unable to debug device: [emulator-serial] 12:24:38 E/hierarchyviewer: Missing forwarded port for [emulator-serial] 12:24:38 E/hierarchyviewer: Unable to load window data for window <Focused Window> on device [emulator-serial]
Command Line
From the command line, restarting ADB is super easy:
$ adb kill-server $ adb start-server # ... `adb devices` to check for connected devices
Android Device Monitor
You can fire up ADM from Eclipse, Android Studio or tools/monitor
(in your sdk folder). There in the DDMS view, on the left hand side you’ll find a pane with a list of all the devices connected and around 12 icons above that. One of them will be a down arrow, click that and choose “Reset adb” from the newly opened context menu. That should do the trick!
This SO answer has images included.
Along with the adb
restarts, you might as well have to restart the emulator and ADM.
Hope that helps!