Testing multiple Android devices on the same machine

I have two different Android devices connected to the same machine. What I would like to do is target each device and run it separately.

Unfortunately, it seems that I need to disconnect one of the devices to run the test every time, because if this does not happen, I get the following error:

error: more than one device and emulator 

Does anyone know about this for this problem so that I can just lock both devices and run tests?

+8
android testing device calabash-android
source share
3 answers

You can specify the target device in the adb command with -s

1) Get the device serial number by doing

 $ adb devices List of devices attached emulator-5554 device emulator-5556 device emulator-5558 device 

2) Go to serialNumber in adb command with -s argument

 $ adb -s <serialNumber> <command> 

for example

 $ adb -s emulator-5556 install helloWorld.apk 
+2
source share

You need to set the environment variable ADB_DEVICE_ARG to the serial number of your device returned by adb devices .

So, to add the answer to Robert :

 $ adb devices List of devices attached emulator-5554 device emulator-5556 device emulator-5558 device $ ADB_DEVICE_ARG=emulator-5554;calabash-android run yourapk.apk 

If you need to run the same Calabash test on multiple devices at the same time, it is better to run them from separate root folders or specify the result in different folders so that the results do not mix.

+2
source share

The command below works for me:

calabash-android run your_app.apk ADB_DEVICE_ARG=<your_device_id>

Hope that helps

+1
source share

All Articles