我怎样才能adb中安装APK到多个连接的设备? [英] How can I adb install an apk to multiple connected devices?
问题描述
我已经7设备插入到自己的计算机。
I have 7 devices plugged into my development machine.
通常我做的 ADB安装<路径APK>
键,可以安装只是一个单一的设备
Normally I do adb install <path to apk>
and can install to just a single device.
现在我想对我所有的7连设备上安装APK我。我怎样才能做到这一点在一个命令?我想也许是运行脚本。
Now I would like to install my apk on all of my 7 connected devices. How can I do this in a single command? I'd like to run a script perhaps.
推荐答案
您可以使用 ADB设备
来获取连接的设备的清单,然后运行 ADB -s DEVICE_SERIAL_NUM安装...
为每个列出的设备。
You can use adb devices
to get a list of connected devices and then run adb -s DEVICE_SERIAL_NUM install...
for every device listed.
喜欢的东西(庆典):
adb devices | tail -n +3 | cut -sf 1 -d " " | xargs -iX adb -s X install ...
评论认为这可能会更好地为新版本:
Comments suggest this might work better for newer versions:
adb devices | tail -n +2 | cut -sf 1 | xargs -iX adb -s X install ...
对于Mac OSX(而不是在Linux上测试过):
For Mac OSX(not tested on Linux):
adb devices | tail -n +2 | cut -sf 1 | xargs -I {} adb -s {} install ...
这篇关于我怎样才能adb中安装APK到多个连接的设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!