问题:
电脑连接两台以上的android 设备时
adb shell
会返回
more than one device
解决方法:
- Step1.获取设备列表
adb device
返回:
List of devices attached
87381d28093700000000 device
yasudyasadasdasdasda device
- Step2.指定设备shell(比如选择123456)
adb -s 87381d28093700000000 shell
但是输入这么长的序列号,我还不如直接把其他的设备都拔掉…
或许可以写个脚本:
#!/bin/bash
PS3="please select a device :"
array=($(adb devices | grep ".device$"))
i=0
length=${#array[@]}
while [ "$i" -lt "$length" ];do
if
((i%2!=0))
then
unset array[i]
fi
((i++))
done
((length++))
array[$length]=exit
select var in "${array[@]}" ;do
break
done
if
[[ "$var" != "exit" ]]
then
echo "Please complete the order :"
read -p "adb -s $var " cmd
adb -s $var $cmd
fi
运行效果:
此脚本适用于Linux和Mac
vim adbdevice
2.拷贝代码
3.添加可执行权限
sudo chmod +x adbdevice
4.运行