Can hierarchyviewer be used with a real device other than the Nexus?

▼魔方 西西 提交于 2019-11-27 15:41:33

问题


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


回答1:


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.




回答2:


HierarchyViewer works only on debug/engineering device.




回答3:


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.




回答4:


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



来源:https://stackoverflow.com/questions/6011008/can-hierarchyviewer-be-used-with-a-real-device-other-than-the-nexus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!