I am new to android development I started using "Hierarchy Viewer"...it works fine with emulator that comes up with sdk.
The thing is I want to use this on a real device. I have made my research and found because of security reasons it works only on emulator and developers phone, from various sources.
Official Android Developer Site
But I also found that by using the "ViewServer.java" in our project, we can use this tool on real device.
GitHub romainguy / ViewServer Link:
What I understand is there are 2 things to be done...
Include this ViewServer.java into our project
Add the INTERNET permission in manifest.(
<uses-permission android:name="android.permission.INTERNET"/>
)
And while reading the comments in the java file, I also understood how to use addWindow
method inside onCreate
and stuffs.
But even after all these while trying to install this app into my device, eclipse "Invalid APK File!"...for both real device and emulator.
But normal apps works with emulator, but not the app added with this java file in it!!!
And someone kindly explain me if anything else needs to be done. Because the link I shared have so many other files and I am not sure what they are and how to use them. All I cared about is the "ViewServer.java" file in it.
If possible can someone explain me step by step on what are all needs to be done?
Have a look a the link following below it has detail information about how to enable hierarchy viewer in actual device
How to show hierarchy viewer in android device
Try using HierarchyViewerSupport Annotation but not sure how much it will be of help.
This @HierarchyViewerSupport annotation allows you to use the HierarchyViewer inspection tool on any device.
Make sure your application has INTERNET permission and android:debuggable = true Manifest.
Just annotate your activity with @HierarchyViewerSupport :
I am not sure dude how much this could help based on your question i did bit RnD, i think its not possible on production builds as reason you already explained.
Anyway if you want details of your current activity screen like info about widgets and all you can still get it using a Python Script as well which i have developed but again it does not work on production build.
Try this above solution and let us know if it helps.
ViewServer
is required only on non-rooted devices with Android older than 4.1.For devices with Android 4.1+ all you need is to set
ANDROID_HVPROTO=ddm
environmental variable and restart adb server.It's one of the hidden Android features, found it on free Udacity course - Android Performance (Lesson 1: Render, 12th part "Hierarchy Viewer Walkthrough", links below video).