Hierarchy Viewer only works by default with phones running a developer version of the Android OS. If your phone is not a developer phone, you have a few options:
If you have a phone running Jellybean or higher, you can simply add the environment variable ANDROID_HVPROTO with the value ddm:
ANDROID_HVPROTO=ddm
You can run Hierarchy Viewer on an emulated phone.
Or you can use use the ViewServer library to get Hierarchy Viewer working on a non-developer, pre Jellybean phone.