Android Emulator HierarchyViewer “Unable to get view server protocol version from device” Error

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:

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!

Efficient Android Threading - I highly recommend this book if you want to learn how various components of the Android framework works. You'll learn a ton about Android internals and components like AsyncTask, Services, Broadcast Receivers, Executor Framework, Inter-Process Communication, etc. It also covers various OS internal topics like threads, processes, kernel and how all those components work to execute an Android app. Must read!

Author: Rishabh

Rishabh is a full stack web and mobile developer from India. Follow me on Twitter.

1 thought on “Android Emulator HierarchyViewer “Unable to get view server protocol version from device” Error”

Leave a Reply

Your email address will not be published. Required fields are marked *

*