This question already has an answer here:
I am currently using bash and adb to automate configurations on Android devices. When I run my code on one device, the 'adb shell input tap xxx xxx' commands are 100% accurate and do their job well.
When I run the script on multiple devices, the coordinates seem to change - the device starts clicking at seemingly random spots on the screen, as if they have reassigned themselves new locations.
Logically, what could be happening right here? Relevant parts of the script are below.
DeviceConfig () {
#Location
./adb -s "$usb" shell am start -n com.android.settings/.Settings
./adb -s "$usb" shell input tap 215 695
./adb -s "$usb" shell input tap 1210 55
#Icons
./adb -s "$usb" shell am start -n com.estrongs.android.pop/.view.FileExplorerActivity
sleep 7
./adb -s "$usb" shell input tap 165 500
./adb -s "$usb" shell input tap 165 500
./adb -s "$usb" shell input tap 165 500
./adb -s "$usb" shell input tap 165 500
sleep 1
./adb -s "$usb" shell input tap 155 150
sleep 1
./adb -s "$usb" shell input tap 155 374
sleep 1
./adb -s "$usb" shell input swipe 680 130 680 130 1500
sleep 1
./adb -s "$usb" shell input tap 920 130
sleep 1
./adb -s "$usb" shell input tap 1185 723
sleep 1
}
for usb in $(./adb devices -l | awk '/ device usb:/{print $3}'); do DeviceConfig $usb ; done
I am assuming you are talking about identical devices here.
If your devices are just laying on top of a horizontal surface - some of the devices could be in a different display orientation mode which would skew your coordinates.
You could either make sure all of your devices are in the same (let's say upright) position or you could set them to a fixed orientation before running your automation. Or better yet - stop using absolute coordinates for your emulated touches.