24

I'd really like to use hierarchyviewer with my Samsung Galaxy S. Is there any way to turn it into a developer phone?

Pang
  • 9,564
  • 146
  • 81
  • 122
Barry Fruitman
  • 12,316
  • 13
  • 72
  • 135

4 Answers4

37

RomainGuy is correct, but since he had developed the debug ViewServer you can use HierarchyViewer for your own application on ANY phone now. To do this simply add RomainGuy's ViewServer into your application.

https://github.com/romainguy/ViewServer

From ViewServer JavaDoc:

This class can be used to enable the use of HierarchyViewer inside an application. HierarchyViewer is an Android SDK tool that can be used to inspect and debug the user interface of running applications. For security reasons, HierarchyViewer does not work on production builds (for instance phones bought in store.) By using this class, you can make HierarchyViewer work on any device. You must be very careful however to only enable HierarchyViewer when debugging your application.

To use this view server, your application must require the INTERNET permission.

If you use Android Annotations library, it's even simpler - just annotate your activity with @HierarchyViewerSupport annotation.

Volo
  • 28,673
  • 12
  • 97
  • 125
  • 5
    When RomainGuy wrote his answer he hadn't developed debug ViewServer yet ;) – Volo Oct 08 '11 at 20:32
  • I want to run it on program that I didn't develop , how can I do that ? – Mohammed Subhi Sheikh Quroush Jul 09 '13 at 13:23
  • @MohammedSubhiSheikhQuroush if you don't have rooted device this is not possible. If your devices is rooted, there are several options available: 1) [Patch `WindowManagerService.isSystemSecure()`](http://blog.apkudo.com/2012/07/26/enabling-hierarchyviewer-on-rooted-android-devices/), 2) [patch `default.prop` file in `boot.img`](http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images), 3) Install XPosed Framework, and [hook activity methods](https://github.com/rovo89/XposedBridge/wiki/Development-tutorial) mentioned in `ViewServer` documentation – Volo Mar 06 '14 at 20:43
11

HierarchyViewer works only on debug/engineering device.

Romain Guy
  • 97,993
  • 18
  • 219
  • 200
2

See my answer here - on devices with Android 4.1+ the only thing you need is to set the environmental variable ANDROID_HVPROTO=ddmand restart adb server.

Community
  • 1
  • 1
Fenix Voltres
  • 3,448
  • 1
  • 29
  • 36
2

Follow the steps given here

Then restart the hierarchyviewer by going to:

  • /Library/Android/sdk/tools on a Mac
  • C:\Program Files\Android\Sdk\tools on Windows

and run ./hierarchyviewer

Matthew Read
  • 1,365
  • 1
  • 30
  • 50
timberlake
  • 777
  • 6
  • 13