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 其中 ...
随机推荐
- AI学习---数据读取&神经网络
AI学习---数据读取&神经网络 fa
- python + MySql 基本操作
python + mysql数据库的链接 1.安装mysql pip install PySQLdb 2.连接数据库 # -*- coding: UTF- -*- import MySQLdb # 打 ...
- 将含有makefile文件的源码加入Eclipse工程
转载自https://www.linuxidc.com/Linux/2011-02/32763.htm 很多软件在开发或者分析时需要一个像样的IDE,Eclipse是其中很优秀的一个,至少个人感觉很好 ...
- KFCM算法的matlab程序
KFCM算法的matlab程序 在“聚类——KFCM”这篇文章中已经介绍了KFCM算法,现在用matlab程序对iris数据库进行简单的实现,并求其准确度. 作者:凯鲁嘎吉 - 博客园 http:// ...
- 《数据库技术基础与应用(第2版)》学习笔记——第7章~
从这章开始,操作的内容开始增多,概念的东西越来越少,可能跟学校的教学目的有关,但是跟我的学习目的不匹配,就不再继续整理. 总结:这本书适合大学本科生学习和了解数据库的相关知识以及Access和SQL ...
- MVC四大筛选器—ExceptionFilter
该筛选器是在系统出现异常时触发,可以对抛出的异常进行处理.所有的ExceptionFilter筛选器都是实现自IExceptionFilter接口 public interface IExceptio ...
- 超简单的gif图制作工具
测试成功了: 软件灵者Gif录制1.0 使用方法注意: 扩展: 安卓端想要制作gif可参考此方法(还没测试):https://blog.csdn.net/u012604745/article/deta ...
- vue调试工具的安装
开发避免不了的就是调试工具,因为vue是进行数据驱动的,单从chrome里面进行element查看,查不到什么鸟东西,必须要进行对数据动向进行关查 首先是下载这个工具,github下载地址:https ...
- B - Moo Volume
Farmer John has received a noise complaint from his neighbor, Farmer Bob, stating that his cows are ...
- BSOJ 5603 -- 【SNOI2017】炸弹
题好数据水系列,网上的十几行神仙解法A了原数据. 这道题要用到线段数优化建图的知识.然而考试考到这道题时我还不会. 我们设分别表示每个炸弹向左和向右最远能炸到哪个炸弹.很容易想到一个思路,就是每个炸弹 ...