![如何修复:无法绑定‘tcp:5037’:地址已在使用中ADB服务器没有ACK *无法启动守护进程?](https://linux22.com/image/1202564/%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%EF%BC%9A%E6%97%A0%E6%B3%95%E7%BB%91%E5%AE%9A%E2%80%98tcp%EF%BC%9A5037%E2%80%99%EF%BC%9A%E5%9C%B0%E5%9D%80%E5%B7%B2%E5%9C%A8%E4%BD%BF%E7%94%A8%E4%B8%ADADB%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%B2%A1%E6%9C%89ACK%20*%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%E5%AE%88%E6%8A%A4%E8%BF%9B%E7%A8%8B%EF%BC%9F.png)
我想将文件推送到 SD 卡和模拟器,然后再次刷新每个模拟器。
这是我的代码
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
您可以使用以下命令找出哪个应用程序或进程正在监听端口:
udo netstat -peant | grep ":5037"
或者
lsof -i :80
获取监听该端口的进程的进程 ID,并使用以下命令将其终止:
sudo kill -9 <process id>