uiautomatorcajviewer乱码 真机汉字乱码怎么解决

uiautomatorviewer 真机汉字乱码怎么解决_百度知道
uiautomatorviewer 真机汉字乱码怎么解决
我有更好的答案
在cmd窗口中,使用命令: adb root然后再试一下
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁android自动化测试中hierarchyviewer和uiautomatorviewer获取控
android自动化新人一个,目前研究PC端获取android设备的控件信息有哪些方式。多多指教! adroid的目录tools下有2个自带的工具hierarchyviewer和uiautomatorviewe
&&&&&&& android自动化新人一个,目前研究PC端获取android设备的控件信息有哪些方式。多多指教!
&&&&&&& android的目录tools下有2个自带的工具hierarchyviewer和uiautomatorviewer,打开后,如下所示:
&&&&&&& 分别来介绍它们怎么使用的:
&& UiAutoMatorViewer
&点击左上角的手机图样的小图标,出现弹出框,此时正在获取信息:
&&&&&&&& 完成获取后得到了当前的手机界面:
&&&&&&& 然后你可以点击主面板中的图片,右面的属性面板会显示你所点击的区域的控件属性。(需要注意到是,你的手机设备或模拟器的api要在16以上,也就是android版本得是4.1以上,因为这个工具是google在4.以后推出来的,只适用于4.1以后的版本)。
&&&&&&& 到这一步,我了解了如何使用这个工具,但是并不是我要研究的东西。我要知道他是如何和手机设备通信,然后获取控件信息的,所以我反编译了uiautomatorviewer.jar,以便从源码了解它的原理。
&&&&&&& 在tools/lib下找到uiautomatorviewer.jar。反编译后项目结构如下所示:
&&&&&&& 首先查看UiAutomatorViewer.class,打开后明显看出这是一个java.swt的主界面类,那我们只需要找到工具栏中的按钮的定义。我们就能追踪到点击它是怎么得到设备控件信息的。
&&&&&&& 找到这个按钮的定义后,我们按ctrl键 点击鼠标跟踪进去,发现该类中有一个进度条对话框,这正是我们先前点击按钮出现的对话框,这里面肯定定义信息获取的方式。
&&&&&&& 查看上面的代码分析得到,UiAutoMatorHelper的子类UiAutoMatorResult和对象result,它得到了UiAutomatorHelper方法和takeSnapShot返回的结果,那么我就去这个方法一探究竟。进入UiAutomatorHelper中,找到takeSnapshot方法。
public static UiAutomatorResult takeSnapshot(IDevice device, IProgressMonitor monitor) throws com.android.uiautomator.UiAutomatorHelper.UiAutomatorException
UiAutomatorM
RawImage rawI
if (monitor == null) {
monitor = new NullProgressMonitor();
monitor.subTask(&Checking if device support UI Automator&);
if (!(supportsUiAutomator(device))) {
String msg = &UI Automator requires a device with API Level 16&;
throw new com.android.uiautomator.UiAutomatorHelper.UiAutomatorException(msg, null);
monitor.subTask(&Creating temporary files for uiautomator results.&);
File tmpDir =
File xmlDumpFile =
File screenshotFile =
tmpDir = File.createTempFile(&uiautomatorviewer_&, &&);
tmpDir.delete();
if (!(tmpDir.mkdirs()))
throw new IOException(&Failed to mkdir&);
xmlDumpFile = File.createTempFile(&dump_&, &.uix&, tmpDir);
screenshotFile = File.createTempFile(&screenshot_&, &.png&, tmpDir);
} catch (Exception e) {
msg = &Error while creating temporary file to save snapshot: & + e.getMessage();
throw new com.android.uiautomator.UiAutomatorHelper.UiAutomatorException(msg, e);
tmpDir.deleteOnExit();
xmlDumpFile.deleteOnExit();
screenshotFile.deleteOnExit();
monitor.subTask(&Obtaining UI hierarchy&);
&span style=&color:#ff0000;&&getUiHierarchyFile(device, xmlDumpFile, monitor);
} catch (Exception e) {
msg = &Error while obtaining UI hierarchy XML file: & + e.getMessage();
throw new com.android.uiautomator.UiAutomatorHelper.UiAutomatorException(msg, e);
你最喜欢的Document Viewer乱码解决方法_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
Document Viewer乱码解决方法
上传于||暂无简介
阅读已结束,如果下载本文需要使用
想免费下载本文?
你可能喜欢安卓开发高手进,布局调试
[问题点数:100分,结帖人u]
安卓开发高手进,布局调试
[问题点数:100分,结帖人u]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
2013年3月 总版技术专家分月排行榜第二
2014年2月 Java大版内专家分月排行榜第一2013年8月 Java大版内专家分月排行榜第一2013年5月 Java大版内专家分月排行榜第一2013年4月 Java大版内专家分月排行榜第一2013年3月 Java大版内专家分月排行榜第一2013年2月 Java大版内专家分月排行榜第一
匿名用户不能发表回复!|
每天回帖即可获得10分可用分!小技巧:
你还可以输入10000个字符
(Ctrl+Enter)
请遵守CSDN,不得违反国家法律法规。
转载文章请注明出自“CSDN(www.csdn.net)”。如是商业用途请联系原作者。uiautomator 读取xml的文件时乱码_百度知道
uiautomator 读取xml的文件时乱码
uiautomator 读取xml的文件时乱码,怎么破
文件和工程都是UTF-8,但是运行是读取xml出来的中文是乱码
我有更好的答案
设置编码格式为UTF-8
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 uiautomator 中文乱码 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信