如何使"层次观众QUOT;在真实的设备? [英] How to make "Hierarchy Viewer" work in a real device?

查看:636
本文介绍了如何使"层次观众QUOT;在真实的设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新android开发,我开始使用层次浏​​览器...它正常工作与仿真器自带了SDK。
问题是我想用这个真实设备上。我做了我的研究和发现,由于安全原因,只能在模拟器和开发人员的电话,从各种来源。

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.

官方Android开发者网站

不过,我也发现,在我们的项目中使用ViewServer.java,我们可以使用真实的设备这个工具。

But I also found that by using the "ViewServer.java" in our project, we can use this tool on real device.

GitHub上romainguy / ViewServer链接:

我的理解是,有两件事情要做......

What I understand is there are 2 things to be done...

  1. 包括这个ViewServer.java到我们的项目

  1. Include this ViewServer.java into our project

添加Internet的权限清单中(<使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>

Add the INTERNET permission in manifest.(<uses-permission android:name="android.permission.INTERNET"/>)

和同时阅读的评论在java文件,我也明白了如何使用 addWindow 法里面的onCreate 和东西。

And while reading the comments in the java file, I also understood how to use addWindow method inside onCreate and stuffs.

但是,即使所有这些尝试安装此应用到我的设备,日蚀无效的apk文件!......为真实设备和仿真器。

But even after all these while trying to install this app into my device, eclipse "Invalid APK File!"...for both real device and emulator.

但正常的应用程序与模拟器在它的工作原理,但不是与这个Java文件中添加的应用程序!

But normal apps works with emulator, but not the app added with this java file in it!!!

和别人好心给我解释一下,如果需要别的工作要做。因为我分享的链接有这么多其他的文件,我不知道它们是什么以及如何使用它们。我所关心的是它的ViewServer.java文件。

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?

推荐答案

ViewServer 仅在非root权限的设备与Android超过4.1是必需的。

ViewServer is required only on non-rooted devices with Android older than 4.1.

对于Android设备4.1+所有你需要的是设置 ANDROID_HVPROTO = DDM 环境变量和重新启动ADB服务器。

For devices with Android 4.1+ all you need is to set ANDROID_HVPROTO=ddm environmental variable and restart adb server.

这是隐藏的Andr​​oid功能之一,发现它免费Udacity课程 - Android的性能(第1课:渲染,第12部分层次浏览器演练,下面的视频链接)。

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).

这篇关于如何使&QUOT;层次观众QUOT;在真实的设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆