Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is hierarchyviewer not working for Samsung Galaxy TAB 7.0?

I've used hierarachyviewer earlier, but on android emulator. It works absolutely fine when I use it on the emulator. However it does not work with Samsung Galaxy TAB 7.0, with Android 2.3.4.

This is the log, that I get

11:04:22 E/hierarchyviewer: Unable to get view server version from device 303599
64881B00EC
11:04:22 E/hierarchyviewer: Unable to get view server protocol version from devi
ce 30359964881B00EC
11:04:24 E/hierarchyviewer: Unable to debug device 30359964881B00EC
11:05:05 E/hierarchyviewer: Unable to get view server version from device 303599
64881B00EC
11:05:05 E/hierarchyviewer: Unable to get view server protocol version from devi
ce 30359964881B00EC
11:05:07 E/hierarchyviewer: Unable to debug device 30359964881B00EC
11:09:38 E/hierarchyviewer: Unable to get view server version from device 303599
64881B00EC
11:09:38 E/hierarchyviewer: Unable to get view server protocol version from devi
ce 30359964881B00EC
11:09:40 E/hierarchyviewer: Unable to debug device 30359964881B00EC

I'm also not using hierarchyviewer in the debug mode, just running the application. Thanks.

like image 335
Harshal Kshatriya Avatar asked May 18 '12 05:05

Harshal Kshatriya


3 Answers

I found a workaround: https://github.com/romainguy/ViewServer

ViewServer is a simple class you can use in your Android application to use the HierarchyViewer inspection tool...

  • Verify that you need this library(newer versions of Android don't)

If you do need this library then follow these directions:

  • Include the ViewServer library(easy directions found here)
  • Your application must require the INTERNET permission
  • The recommended way to use this API is to register activities when they are created, and to unregister them when they get destroyed:

    public class MyActivity extends Activity {
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            // Set content view, etc.
            ViewServer.get(this).addWindow(this);
        }
    
        public void onDestroy() {
            super.onDestroy();
            ViewServer.get(this).removeWindow(this);
        }
    
        public void onResume() {
            super.onResume();
            ViewServer.get(this).setFocusedWindow(this);
        }
    }
    

Please refer to the documentation in ViewServer.java for more info...

like image 168
neworld Avatar answered Nov 18 '22 01:11

neworld


Use the monitor-tool instead (android-sdk/tools/monitor).

Connect to your device. Close Eclipse first if you can't connect.

Press the "Dump view hierarchy for UI automator" button in the devices-tab. Its the one next to the screen-capture button.

Works since API Level 16 (Android 4.1).

like image 21
RhodanV5500 Avatar answered Nov 18 '22 02:11

RhodanV5500


You can only use HierarachyViewer on the emulator and special developer phones bought from google.

http://groups.google.com/group/android-developers/browse_thread/thread/b0b0af7a316ca768

Quote from above link

HierarchyViewer does not work on user builds (i.e. with devices available in stores.) This is for security reasons. If HiearchyViewer was able to work on user builds, any application on your desktop (or even on the phone in some cases) could potentially get access to private information (like logins and passwords.)

like image 35
user1378730 Avatar answered Nov 18 '22 02:11

user1378730