UIAutomatorViewer 出现错误:Unable to connect to adb
最近升级了AndroidSDK,打开UIAutomatorViewer.bat,结果发现获取不了Android设备界面上的UI信息。经过一番努力,终于把这个问题解决了,详细过程如下:
1. Unable to connect to adb.Check if adb is installed correctly.问题:
UIAutomatorViewer.bat位于AndroidSDK\tools\bin路径下,是个十分常用的自动化测试工具,双击运行即可。谁知更新了最新的AndroidSDK之后,运行UIAutomatorViewer.bat就出现了以下错误:
Unable to connect to adb.Check if adb is installed correctly.
2. 解决方案
打开uiautomatorviewer.bat,将最后一句%prog_dir%替换成AndroidSDK\tools路径,保存后再次打开uiautomatorviewer.bat即可得到当前View所有信息。
替换上一句为下面这句:
3. 为什么这么修改就能解决问题了呢?
1) 打开uiautomatorviewer.bat,发现最后一句是关键代码,也许问题就出现在这里。
2) 打印出这最后一句里4个变量,可以得到如图所示路径,除了prog_dir,其他3个很显然都没有问题。
3) 反编译uiautomatorviewer-25.3.2.jar,搜索com.android.uiautomator.bindir,在以下文件中找到相应的代码,
由此可见jar文件里:
A. prog_dir就是这里的toolsDir;
B. Sdk路径是prog_di的父路径;
C. adb路径是prog_di的父路径下platform-tools文件夹。
再看uiautomatorviewer.bat,prog_dir= D:\android\AndroidSDK\tools\bin,因此
A. toolsDir路径就是D:\android\AndroidSDK\tools\bin;
B. Sdk路径是D:\android\AndroidSDK\tools\;
C. adb路径是D:\android\AndroidSDK\tools\platform-tools,显然这个路径并不存在,于是就出现了unable to connect adb。
所以将com.android.uiautomator.bindir设置成AndroidSDK\tools路径,问题就解决了。
UIAutomatorViewer 出现错误:Unable to connect to adb的更多相关文章
- uiautomatorviewer提示Unable to connect to adb. Check if adb is installed correctly解决方法
转自:https://www.jianshu.com/p/c8581a70d1bc 解决方案: 1.打开 "E:\android-sdk_r24.4.1-windows\android-s ...
- 错误 Unable to connect to a repository at URL 'svn://ip地址' 和 No repository found in 'svn://ip地址'
SVN服务器是CentOS6.10 使用TortoiseSVN客户端检出时遇到如下图所示的错误: 是因为没有指定SVN仓库的路径 在SVN服务器执行命令:svnserve -d -r /SVN版本库的 ...
- telnet报“Unable to connect to remote host:Connection refused”错误
Linux下面telnet ip 端口号 报错误"Unable to connect to remote host:Connection refused"的时候,大部分是目标机的端 ...
- [automator篇][5]Viewer 提示connect to adb fail
7. UIAutomatorViewer提示: Unable to connect to adb. Check if adb is installed correctly 解决,sdk升级到了25产生 ...
- svn检出的时候报 Unable to connect to a repository at URL错误(摘自CSDN)
背景:1. SVN服务器:VisualSVN-Server-2.5.5: 2. SVN客户端:TortoiseSVN-1.7.6.22632-x64-svn-1.7.4.msi: 在S ...
- svn 提交错误 400 Bad Reqest MKACTIVITY 请求于XX失败 Conflict Unable to connect to a repository at URL
思路来源:http://www.cnblogs.com/wangyt223/archive/2012/11/22/2782801.html svn 提交错误 400 Bad Reqest MKACTI ...
- selenium 运行之后错误提示Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output
错误提示: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port ...
- unable to connect to ssl://gateway.sandbox.push.apple.com:2195 错误
使用APNS 搭建苹果推送服务器错误:unable to connect to ssl://gateway.sandbox.push.apple.com:2195 错误 1:检查你的服务器的端口 21 ...
- 如何用Adb连接Android手机 & unable to connect to 192.168.1.100:5555的原因和解决方法
利用adb来连接手机, 有两种方式: 1, wifi 2, usb. 1. 通过wifi, 利用adb来连接手机. 在pc的cmd中输入命令: adb connect 192.168.1.100 其中 ...
随机推荐
- jQuery入门(1)
1.了解jQuery与JavaScript的区别 css --你的长相啦 Html --躯干 js --运动神经 jQuery就是对JavaScript的一个拓展,封装,就是让JavaScript更好 ...
- web测试笔记
WEB兼容性测试 一.客户端兼容性 1.浏览器的兼容性测试 a.内核角度 Tridnt内核:代表作IE.腾讯.遨游.世界之窗等 Gecko内核:代表作Firefox webkit内核:代表作Safar ...
- JS页面打印
平常浏览网页和文档的时候,随处可见打印两个字,有时候不小心点到或者快捷键触发到,就会弹出一个打印的页面,上边显示的打印机是GoldGrid Virtual Printer,这是计算机的虚拟打印机,打印 ...
- DefaultNamespaceHandlerResolver中handlerMappings如何初始化
前言:最近一直在看Spring源码,今天在调试的时候发现一个小问题:在注册bean时,需要初始化spring默认命名空间处理器,具体在DefaultNamespaceHandlerResolver中实 ...
- C#语言のC#扩展方法(.Net特性)
this在C#中的常见用法:1.在C#中,this关键字代表当前实例,我们可以用this.来调用当前实例的成员方法,变量,属性,字段等; 2.也可以用this来做为参数状当前实例做为参数传入方法. 3 ...
- NGINX+PHP+ZABBIX,推荐
https://www.cnblogs.com/liuzhennan/articles/5319280.html
- [matlab] 6.粒子群优化算法
粒子群优化(PSO, particle swarm optimization)算法是计算智能领域,除了蚁群算法,鱼群算法之外的一种群体智能的优化算法,该算法最早由Kennedy和Eberhart在19 ...
- linux普通用户提权操作
[root@test1 ~]# vim /etc/sudoers ## Allow root to run any commands anywhere root ALL=(ALL) ALLzhouyu ...
- Rsync服务实战
目录 1 安装rsync软件 2 配置 /etc/rsyncd.conf 3 创建用户(运行rsync服务的用户身份) 4 创建虚拟用户密码文件(客户端连接时候使用) 5启动 rsync 服务,并加入 ...
- Linux 创建静态库(.a)和动态库(.so)
0. 回顾一下 gcc 选项 ============================================== -E : 仅做预处理,例如去注释,宏展开,include 展开等 -S : ...