android模拟器常见问题及解决办法

一、【解决方法】error: more than one device/emulator(亲测好用!)

部分原文:https://www.cnblogs.com/loveniko/p/13253815.html

使用uiautomatorviewer工具遇到以下问题-Unexpected error while obtaining UI hierarchy
手机型号:荣耀V9 安卓9
使用adb工具自带的uiautomatorviewer.bat,打开后连接手机,报错如下:
据说是因为uiautomatorview 不兼容安卓8.0以上版本

在这里插入图片描述

解决方法:
新建一个uiauto.bat文件,代码如下:

adb shell uiautomator dump /sdcard/app.uix
#会在 D:\software\appium下生成app.uix,地址可根据自己的需求进行更改
adb pull /sdcard/app.uix D:\software\appium\app.uix
adb shell screencap -p /sdcard/app.png
#会在 D:\software\appium下生成app.png,地址可根据自己的需求进行更改
adb pull /sdcard/app.png D:\software\appium\app.png

双击运行uiauto.bat文件
打开uiautomatorviewer.bat,导入生成的app.uix和app.png文件,点击OK即可

在这里插入图片描述
原理可以理解成“截屏”:先将手机当前页面给“截屏”生成app.png,并且生成相对应的ui解析文件app.uix,将两个同时导入uiautomatorviewer就可以定位手机页面元素,不方便的是手机页面发生变化就要重新“截屏”一次,所以写成bat文件方便执行

二、adb连接之‘error: protocol fault (couldn‘t read status): Connection reset by peer’问题解决办法

部分原文:https://blog.csdn.net/jinhoward/article/details/108207358
在这里插入图片描述
三、解决问题:

1:使用命令:netstat -aon|findstr “5037” 找到占用5037端口的进程PID。
在这里插入图片描述
2:使用命令:tasklist|findstr “5440” 通过PID找出进程。
3:调出任务管理器,找到这个进程,结束进程。
4:使用命令:adb start-server 启动adb就行了

三、【解决方法】error: more than one device/emulator

部分原文:https://blog.csdn.net/zhyl8157121/article/details/104731029

执行某条 adb 指令之后就报标题的错:

1 error: more than one device/emulator

原因分析
很简单,报错说的很清楚,有多个设备同时连接了电脑。
解决方法
解决方法也很简单,执行 adb 指令的时候,指定执行的设备,就OK了。
比如:

1 adb -s xxxxxx shell ps 21190

其中的 xxxxxx 就是你的设备序列号(serial number)。
获取序列号的方法,执行 adb devices:

mac-mini.lan ~ adb devices
List of devices attached
ENU7N1632353	device
FA6BS03	device
eaafdefbdd	device

可以看到,我现在的电脑一共连了三个手机。
(PS:我把android AVD关掉,这样就只连手机了,就是后续使用就不知道了,现在还没用到)

四、emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable. CPU acceleration status: HAX kernel module is not installed!

(我建议用这个方法之前先看看自己有没有(图一)这个文件夹,建议手动安装一下haxm_check.exe(图二),然后再试一下,不行的话,看看电脑有没有开虚拟化技术(图三),避免和我一样做无用功,如果开了就不用往下看了)
图一

图二
图三
以下原文地址:http://www.cnblogs.com/csulennon/p/4178404.html

emulator: ERROR: x86 emulation currently requires hardware acceleration!Please ensure Intel HAXM is properly installed and usable.CPU acceleration status: HAX kernel module is not installed!
Android Studio 1.0 已经放出来了,以后的Android平台开发激昂逐步从Eclipse向Android Studio迁移,为了能不落伍我也特意从Google下载了Android Studio的安装包,并且兴高采烈地创建了我的第一个android项目。但是当运行的时候就他么悲催了。

BaiduShurufa_2014-12-22_13-56-25
在这里插入图片描述

emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: HAX kernel module is not installed!

模拟器居然启动不起来!报错信息告诉我说是 HAXM没有开,可是“HAXM”到底是什么呀?
image
这是Inter官网告诉我的,作用是管理硬件加速的,估计是用了这个东西模拟器就能告别Eclipse时代的龟速。
你也可以在Inter官网下载这个HAXM,当然Android SDK已经集成了这个软件,你需要做的就是找到他,然后安装它就是了。
他的位置放在这个目录下:
BaiduShurufa_2014-12-22_13-55-38
当然你的位置可能会不一样,如果找不到就没必要死磕开发了。
如果问题就这样解决了,那也太小儿科了吧;当我双击安装,问题又来了:
BaiduShurufa_2014-12-22_13-54-59

this computer meets the requirements for haxm but intel virtualization technology(VT-x) is not turned onHAXM cannot be installed until VT-x is enable 
please refer to the intel HAXM documentation for more information

好吧,继续寻求帮助Inter官方的教程有这样一段话:连接地址:https://software.intel.com/en-us/android/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-windows

Intel VT-x not enabled
In some cases, Intel VT-x may be disabled in the system BIOS and must be enabled within the BIOS setup utility. To access the BIOS setup utility, a key must be pressed during the computer’s boot sequence. This key is dependent on which BIOS is used but it is typically the F2, Delete, or Esc key. Within the BIOS setup utility, Intel VT may be identified by the terms “VT”, “Virtualization Technology”, or “VT-d.” Make sure to enable all of the Virtualization features.

意思是如果安装失败了,那多半是BIOS里面的“Virtualization Technology”选项没有打开,去BIOS里面打开就可以了。

在这里插入图片描述

重新启动安装,就成功了!

在这里插入图片描述

让我们看看Android 5.0炫酷的界面吧:

image

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值