今天在工作中遇到这样的情况,多台设备需要测试,而且使用串口不是很方便,因此就采用了adb进行操作。文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
大家都知道,在我们连接设备后,可以直接使用adb shell 命令进入shell操作,但是当成功连接多个设备后,这样的操作就会出现如下的错误:文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
C:\Users\user>adb shell文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
error: more than one device and emulator文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
很显然,我们应该去指定需要连接的设备,因此,首先我们使用adb devices查看目前连接的设备:文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
C:\Users\user>adb devices文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
List of devices attached文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
172.18.220.179:5555 device文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
172.18.220.180:5555 device文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
有了设备了,就好办了,我们知道adb有一个参数就是指定设备的,因此用上,参数是什么呢?文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
-s文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
好了,那我们就来指定设备连接试试:文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
C:\Users\user>adb -s 172.18.220.180:5555 shell文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
p231:/ $文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
YES,要的就是这个效果,我们进入到了指定的设备,接下来要干嘛就能干嘛了,为了满足下好奇心,就看下IP信息吧!文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
learn more,happy more...文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
文章源自记得要微笑-https://chenxuehu.com/article/2017/02/6142.html
评论