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 其中 ...
随机推荐
- 高性能JavaScript模板引擎 artTemplate
下载地址 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <ti ...
- Lua代码规范
以下规范,是在Unity中使用Lua做为开发语言,仅供参考. 1.格式规范 1. lua文件名统一小写,中间一律不加下划线分割 2. 类名首字母大写,多个词组成的类名,每个词的首字母大写,中间一律不加 ...
- mysql建表基本语法
mysql添加约束的两种条件: ------表的内部添加(约束) 列名1 数据类型 (int) primary key auto_increment,---主键默认不能为空的 列名2 数据类型 not ...
- 【算法】LeetCode算法题-Valid Parentheses
这是悦乐书的第147次更新,第149篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第6题(顺位题号是20),给定一个只包含字符'(',')','{','}','['和'] ...
- C++ 中operator用法:隐式类型转换
[转]C++ operator两种用法 C++,有时它的确是个耐玩的东东,就比如operator,它有两种用法,一种是operator overloading(操作符重载),一种是operator c ...
- 【项目 · Wonderland】会议一 · 可达鸭
[软件工程实践 · 团队项目] 第一次作业 Part 0 · 简 要 目 录 Part 1 · 队 伍 阵 容 Part 2 · 会 议 记 录 相 关 Part 3 · 会 议 讨 论 记 录 Pa ...
- python3编写网络爬虫17-验证码识别
一.验证码识别 1.图形验证码的识别 识别图形验证码需要 tesserocr 库 OCR技术识别(光学字符识别,是指通过扫描字符,然后通过其形状将其翻译成电子文本的过程.)例如 中国知网注册页面 ht ...
- Java(使用JNA)调用DLL库与C#调用DLL库的对比
前言:在项目中经常使用DLL库对硬件进行操作,在发卡过程中使用频率尤为多,今天就Java与C#中调用DLL库的使用区别做一个介绍,本文着重具体的代码编写,具体过程看以下代码. 前提条件: 笔者已经封装 ...
- content-box和border-box
理解box-sizing属性border-box,content-box,其实也是理解正常盒模型与异常盒模型. 如果不做特殊说明,我们日常所用的div都是正常盒子模型. 正常盒子模型 正常盒子模型,是 ...
- js中arguments详解
在js中一切都是对象,连函数也是对象,函数名其实是引用函数定义对象的变量. 什么是arguments? 这个函数体内的arguments非常特殊,实际上是所在函数的一个内置类数组对象,可以用数组的[i ...