How to fix : cannot bind 'tcp:5037': Address already in use ADB server didn't ACK * failed to start daemon?
I want to push a file to an sdcard and emulator and refresh each emulator again.
This is my code
echo "=======PUSH photos AND REFRESH EACH EMULATOR========"
echo "${EMULATORS[0]}"
echo "${EMULATORS[1]}"
echo "${EMULATORS[2]}"
adb kill-server
sleep 30
adb start-server
sleep 30
echo "Trying to push to device ${EMULATORS[index]}"
adb -s ${EMULATORS[index]} push -p ~/dev/test_ttrumpet_portals/rspec_automation/link_android_appium_tests/spec/photo /mnt/sdcard/Pictures
sleep 50
echo "================REFRESH EMULATORS===================="
for index in "${!EMULATORS[@]}" #start all emulators
do echo "Trying to refresh ${EMULATORS[index]}" adb -s ${EMULATORS[index]} shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard sleep 30
done 1 Answer
You can find out which application or process is listening on the port by using the following commands:
udo netstat -peant | grep ":5037"OR
lsof -i :80Get the process id of the process listening to that port and kill it using:
sudo kill -9 <process id> 3