In this short tutorial you will learn how to use adb command to install an APK on a specific Android device if more than one is connected to your computer.
adb – List Android Devices Attached
To list all Android devices connected to your computer use the following command:
adb devices
or
adb devices -l
I have one Android emulator running and one Android device connected to my computer now. If I have adb devices command I get the following output:
List of devices attached 06157df6aaf6c740 device emulator-5554 device
adb – Install APK on Specific Device
Now when you know how to list all attached devices, we can install our APK on one of these devices using same adb command.
adb -s <DEVICE ID> install <PATH TO APK>
where <DEVICE ID> should be replaced with the value of attached device id. The device id from the output of adb devices command.
- List devices with adb devices command:
List of devices attached 06157df6aaf6c740 device emulator-5554 device
2. Use adb -s <device id> install <path to apk> to install on selected device:
adb -s 06157df6aaf6c740 install my-android-app.apk
And this is it!