You might run into this issue when connecting to the Android emulator/device:
Failed to upload <<apk_name>>.apk on device <<device_name>>
java.net.ConnectException: Connection refused: connect
1. Start command prompt and try running the command adb kill-server && adb start-server. (you should cd to the androidsdk\tools directory OR should have added those to the path).
2. If that doesn’t work – kill any instances of adb.exe running, from the task manager. Then restart the adb as told above.