2

WhenI run a project in android studio, I get this error - I/O Error: Connection refused

The emulator starts fine but doesn't pull in/reflect my project

Device connected: emulator-5554
Device is online: emulator-5554
Target device: Nexus4 [emulator-5554]
Uploading file
local path: /Users/martinsjolte/AndroidStudioProjects/FirstAPP1/Firstapp1/build/apk/Firstapp1-debug-unaligned.apk
remote path: /data/local/tmp/dk.first.Firstapp1
Installing dk.first.Firstapp1
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/dk.first.Firstapp1"
Device disconnected: emulator-5554

Launching application: dk.first.Firstapp1/dk.first.Firstapp1.MainActivity.
DEVICE SHELL COMMAND: am start -n "dk.first.Firstapp1/dk.first.Firstapp1.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

I/O Error: Connection refused

My platform is a mac osx ver.12.9.1

Samkit Jain
  • 2,523
  • 16
  • 33
user3387718
  • 41
  • 1
  • 1
  • 3

5 Answers5

7

Ok, I don't know if i got "the" answer. but here is how I've solved the same issue on my environnement ( Windows 8/Android Studio, but same error with ADT or eclipse) :

Context of my issues :

I've got an Asus PC, and with all the application suite installed by default. So I've found that one of this Asus app ( currently "Asus sync") was using adb and in fact, it was taking control of the emulator over my adb in the AndroidSDK directory.


How to fix as a PC user :

Go to Task manager ( right click on task bar) , and look for "adb.exe" . Then right click on it and select "Open the directory". This will bring you to the responding adb. In my case it was Asus Sync, so I just had to unistall this software and everything works fine !


How to fix as a Mac user :

Go to Activity Monitor (/Applications/Utilities/), and look for "adb". Then try to kill the process. Then look if it solve your "Connection refused" in Android studio/ADT or eclipse


If still not working you can try :

  • Start a emulator ( with your AVD manager)
  • when finished loading, Open DDMS panel (in android studio : Menu Tools > Android > Monitors DDMS)
  • Look if you see your current running android emulator ( listed on the Device panel)
  • See if this line is kind of "flashing" ( connect/disconnect).
  • If so, you have probably a other adb instance running in conflict
  • If not, you can restart adb or reinstall your SDK

Hope this could help someone !

Community
  • 1
  • 1
CtrlX
  • 6,946
  • 1
  • 17
  • 21
2

This issue occurs when Android Debug Bridge aka ADB is not responding to the request from Android Studio. I killed the process adb.exe and started it again. This solved my problem.

Sujit Devkar
  • 1,195
  • 3
  • 12
  • 22
2

If you are using a real device :

Just reconnect your device, make sure your cable are workable and you installed the proper drivers.

ralphgabb
  • 10,298
  • 3
  • 47
  • 56
0

I had the same problem, and my problem fixed by restarting the android-studio. Hope, that will help you too.

Narendra Singh
  • 3,990
  • 5
  • 37
  • 78
0

For me the following worked(after I tried the above points mentioned by others):

  1. I tried debugging/running anther application. It was okay. So this pointed me to the direction that the current application has some problem
  2. if (point 1 == true) {I uninstalled the application from my phone manually }

Then re-make/rebuild the application and debug/run worked

Pranaysharma
  • 537
  • 6
  • 13