4

There are lots of times Eclipse can't connect to emulator that I turned on from AVD Manager, and just starts a new emulator by itself,( two emulators are the same ):((. How can I make eclipse find the emulator ?

wanting252
  • 1,139
  • 2
  • 16
  • 22

6 Answers6

13

some times restarting adb solves your problem

adb kill-server
adb start-server

for working easier in command line in windows, add the path of adb.exe to that Windows' path. For example add ";C:\Program Files\Android\android-sdk\platform-tools" to System Properties-> Advanced-> Environment Variables-> System Variables-> Path

One of the reasons of problems in device connection is a long USB cable or a two-piece cables like keyboard USB. try to connect your device to PC directly by a short cable.

Bob
  • 22,810
  • 38
  • 143
  • 225
  • That is why programmers dont like Eclipse. Nothing works as it is supposed. My Android Emulator runs fine (started from within AVD Manager), my code has no errors but still I cant debug or run it. Eclipse (Neon) always says: [MY_AVD] disconnected, blah blah blah. – TomeeNS Jul 12 '16 at 12:57
1

I guess that you might suffer from the issue that the manually started emulator got disconnected somehow, shown with a message like

Error: emulator-5554 disconnected

in the Eclipse console view. There are several related questions and answers on stackoverflow like Why do I get a emulator-5554 disconnected message, but for me none of those answers helped.

Whenever I see the error message for disconnection occur, I just shutdown that emulator and start it again. Normally that already "fixes" the problem, it just works on the next attempt (for me).

Community
  • 1
  • 1
Bananeweizen
  • 21,797
  • 8
  • 68
  • 88
1

I was just experiencing this issue also. I agree with breceivemail, the ADB reconnected to the emulated device after reset, but there is a shortcut using Eclipse:

In the DDMS view => Devices window => View Menu (the down triangle in the header) => reset adb

0

You can choose the target device manually by changing the run configurations.

Run -> Run configurations -> choose your App -> Target tab -> select "Always promt to pick device"

If your device isn't available you will at least don't start a new Emulator.

dnns
  • 180
  • 6
0

If the emulator is still active, you can use adb to connect to it via tcp. In this way you can connect a disconnected emulator to your development system's loopback one port higher, just like if you are using emulator-5554, you can connect to it by using a higher port.

adb connect localhost:5555

There was been an issue with this technique, where the emulator control becomes inactive, and the developer cannot send GPS coordinates or SMSs or calls to emulator.

There is a one click method to do this

  1. Open notepad
  2. Type the below code

    @echo off

    adb connect localhost:5555

  3. Save the file as your_file_name.BAT

  4. Copy the file to Android SDK/platform_tools
  5. Create a shortcut, give it a custom icon, use it anywhere you like
Niko
  • 1,367
  • 1
  • 13
  • 37
-1

Open the DDMS view from Eclipse, and simply click on the emulator name you want connect to in 'Emulator' tab.

jasen.yin
  • 92
  • 1
  • 5
  • 1
    if the emulator is disconnected from adb, in eclipse ddms view, emulator tab, not show the emulator. – ademar111190 May 08 '13 at 06:36
  • A disconnected emulator wont be shown in DDMS view of Eclipse! – Niko May 14 '13 at 07:34
  • Check if there is another process of adb which was not started by Eclipse, if yes, kill that process first, then the emulator should be connected. – jasen.yin May 30 '13 at 00:34