How to attach back the Android emulator to ADB? - android

After I start the emulator by hitting Debug in Eclipse, after certain time it disconnects from the ADB, but the emulator stays open. It is responsive, I can navigate and start apps.
How can I attach back the emulator to ADB, to be able to debug from Eclipse?
(the current workaround is the terminate the emulator, close Eclipse and restart both of them, which takes 10 minutes as you know the emulator needs time to start up)
EDIT 1
Check out this image:
EDIT 2
After I kill and restart server. One emulator process shows up in Devices tab in Eclipse. But that cannot be expanded, and I don't see sub-processes.
I can't hit debug already, as it says: Debug already running. (How to I stop the debug?)
If I managed to start the debugging of another project, It hangs out in the emulator telling me: Waiting for the debugger to attach. Nothing happens.

As you said, the problem is not Eclipse losing contact with the Emulator, but ADB - the Android Debug Bridge - losing contact with it. As Eclipse uses ADB to communicate with the emulator when ADB is broken Eclipse can do nothing.
To fix this stop the ADB server by running the following command:
adb kill-server
Eclipse will then usually try to restart ADB, or you can restart it yourself by running an ADB command, such as:
adb devices
If you do, you'll see output like this:
* daemon not running. starting it now *
* daemon started successfully *
List of devices attached
emulator-5554 device
You can also do this via the mouse, using the Reset adb option in the Devices view in Eclipse.
It's also worth noting the Console view has two modes, DDMS and Android. You're usually in Console mode but it's DDMS mode which will show ADB status messages. Select modes by clicking the button with the Monitor icon, or using the arrow next to it:
If all else fails, try killing the adb processes from the OS. On Windows XP I use:
TASKKILL /F /IM adb.exe

There is an easier way. From eclipse you can reset the adb from DDMS panel.
Here's a short video on doing that "Reset ADB on DDMS"
Here's a quick screenshot of where you can get the option.

Sometimes a kill-server won't help at my machine (WinXP). For example I can't see the emulator in the DDMS-View any more or I do see it but no processes running on it.
In these cases I close the emulator and eclipse and manually kill the adb.exe-process from the process list.
When I then restart eclipse and the emulator, everything's fine again.
Now I just need a keyboard-shortcut for that :-)

on a mac, i just had to kill adb from activity manager and manually re-open the program again. had eclipse open all through and it worked just fine.

Try with adb kill-server and adb start-server. Even then the same problem occurs kill your running process from ddms prespective. Refer this link(http://www.jiahaoliuliu.com/2011/02/stopping-android-applications-already.html). This solved my issue. Hope for you also.

I am testing an application on an Android 4.0 (API level 14) emulator and once I run the app the emulator starts up and as soon as it loads, Eclipse DDMS disconnects from the emulator.
Here is the workaround that I am using: Open terminal, navigate to platform tools (C:\android-sdk\platform-tools\ or wherever you have your android-sdk installed), and run adb kill-server, and then run, adb start-server. DDMS should now list the emulator - from Java perspective, right click on the app -> Run As -> Android Application.
Hope this helps.

My handy bash script
#!/bin/bash
./path/to/adb kill-server
./path/to/adb start-server
./path/to/adb devices

Related

ADB server can't start android

I have installed adt bundle eclipse. However, I can't seems to run the AVD. I have the problem of
ADB server didn't ACK
failed to start daemon
I have search on how to solve it, I've read to type adb kill-server and adb start-server. when I typed that, it says
adb server is out of date. killing...
ADB server didn't ACK
* failed to start daemon *"
Please follow below steps:-
Go to run
open command prompt
get into your platform-tools under android sdk.
now type command: adb kill-server
then upon success type: adb start-server
Thats'it.
Let me know if you still facing any issue..
I had this exact problem on my Vista x64 system. I solved it by doing the following:
Ctrl-Alt-Del, start Task Manager, under Processes tab, check for "shuame_helper.exe". It was there from running RootGenius. I clicked End Process, then went back to the command prompt and entered adb start-server and it worked!
Try below step from DDMS in eclipse :
So I had the same problem and failed in all the same ways as above:
adb kill-server
followed by
adb start-server
still resulted in the ADB server didn't ACK error.
The other common suggestion of using the task manager to kill the process also
failed as it seemed that something restarted adb automatically? It would disappear for a second, then there were two adb processes ,then there was one again.
Exasperated.
I restarted Windows in safe mode.
This ensured that adb wasn't started.
Shut down and restart normally. Problem solved.
Just for good measure, I also updated eclipse and android at this point, but I think that the safe mode restart fixed it.
Give it a try when all else fails.
When this happens I open Activity Monitor (on mac) or Task Manager (on windows) and look for the ADB process and force close it (sometimes there are more than one, close those to) and then press the Run button again in Android Studio or Eclipse.
1)Open task manager first
2)close any instance of adb.exe(end task it)
3)open command prompt
4) type adb start-server(you may have to execute it twice)
5) try to run now.
I had this problem using the latest ADT, SDK and Eclipse on Windows 7. I had an old ASUS TF101 and an HTC HD connected with their respective docking software. When I looked in processor tab of the Windows task manager I could see two instances of the adb.exe, one loaded and another one looking like it is trying to load.
I killed the PC connecting software (process in task manager) for the ASUS, the HTC Sync wasn't running. There is now one adb.exe running and both devices are recognised in Eclipse and in the command prompt (adb devices). You may need to restart Eclipse.

Intellij 13 ADB not responding

Launching ADB in intellij,says ADB not responding.you can wait more, or kill adb.exe.process
manually and click Restart..how do i fixed this?.I really could not run my android project.I am using windows 7...I tried to run command ADB KILL-SERVER but it doesn't work at all.
Thank you.
There are some ways to get rid of this message
use this commands
(adb kill-server) and
(adb devices)
kill adb from Task Manager and start it again (similar to 1)
be sure that debugging mode is enabled on your device
restart your device
restart your computer
If you are using windows, then start task manager (ctl+alt+del press) and from process list select adb.exe and stop or kill. Works for me :)

could not access the package manager. is the system running while installing android application

While installing the android application in the emulator I am getting the following error.
Please help me to resolve this error.
Error message:
emulator.exe -avd avd_name
adb wait-for-device
adb install path-to.apk
could not access the package manager. is the system running while installing android application....
You need to wait for the emulator to full start - takes a few minutes. Once it is fully started (UI on the emulator will change), it should work.
You will need to restart the app after the emulator is running and choose the running emulator when prompted.
As other have said, this error occurs because the emulator is still in the process of launching. An attempt to access the package manager, for the device, at this time causes an error.
It's just a simple timing issue. Here are the steps to avoid this error:
Wait until the emulator 'lock screen' is showing.
Run the 'app' again (^R in most IDE's).
Choose the running device (Should be the same emulator).
App should install without error.
In my case it was just that the emulator took 9 minutes to start. Wait until you see the lock icon on the emulator LCD. Or use actual tablet or phone.
Facing Same issues following Link helped solving the problem. The above solutions were not helpful for me.
deployment-failed-could-not-access-the-package-manager-is-the-system-running
By restarting server using CMD application was back to work. Open cmd (Run as administrator), open this
cd C:\Program Files (x86)\Android\android-sdk\platform-tools
(this path must specify your android-sdk installation folder )
Now, first write,
adb kill-server and then adb start-server.
Kill the process/server and restart it.! It worked.
You can avoid the error by setting default device before launching application. Launch the AVD before starting the app.
Once you see this error, wait for emulator to show lock screen. And then relaunch the app in your IDE and check the emulator again. It works for me always.
In Android studio, you can relaunch by clicking the green play button or ctrl + r.
If this error is gotten when using a rooted device's su prompt and not from emulator, disable SELinux first
setenforce 0
You may need to switch to shell user first for some pm operations
su shell
then re-run your pm command.
Same applies to am commands unavailable from su prompt.
The solution for me was to restart the IDE. I suspect that a slow emulator was hiding from view, blocking installation on my device.
Check your project build is in Debug mode not Release, I had some problem for debugging always I forget to change Release mode to Debug (Xamarin Users)

'adb devices' showing dummy device

I have been facing this problem for quite sometime now. Running 'adb devices' shows me an additional dummy device although its named as emulator-5554. FYI, I don't have any emulator running as well.
adb devices
List of devices attached:
xxxxxxx device (Actual device)
emulator-5554 device (Dummy thingy shown as device).
How do I clean up this mess?
Same problem for me but I don't see any Bluestacks service in my services list. after
adb devices shows emulators I didn't have, I usually just type the command
adb kill-server
and running the
adb devices
once more shows only the devices that are connected.
I had the same issue. I did this and now everything is ok
click Windows+R
type services.msc
stop BlueStacks Android Service
I have figured out the issue. I had installed Bluestacks for Mac for trying out Android apps on Mac. This was running an emulator with a different name.
Figured it out by taking a screenshot of the emulator and it showed the launch screen of Bluestacks. Uninstalled Bluestacks and all is well now.
the adb server is scanning for emulators on all even local ports from 5555 to 5555+128 (5683). If you have a custom service which use one of these ports... You are stuck with the "adb -d command" requirement
pls check in task manager whether emulator-arm.exe is running. If so, try stopping both adb.exe and emulator-arm.exe
I had the same problem and non of these answers helped. So I figured out that my system didn't shut down properly and that's the reason I have a dummy emulator-5554. The solution was to create a new emulator with a name then launch it? While it's launching kill the server using cmd until when the emulator powers on and you can see its name under Devices in DDMS. After this shut the emulator...emulator-5554 is gone, Now you can start Bluestacks and connect
I was facing the same issue, and that due to BlueStacks too. In case you have Windows and you don't want to remove it, then you can stop its service "BlueStacks Android Service."
To do that click Windows+R, type services.msc then stop "BlueStacks Android Service"
Reference:
http://forum.xda-developers.com/showthread.php?t=2612389
Eclipse emulator NOT BlueStacks:
In the case of the eclipse emulator running in the background and you don't know how to close it, just go to devices tab and choose the dropdown menu on the right, then Reset adb. OR, just reset the adb using adb console.
Just open task manager and end task bluestacks
I also meet the same problem.Here is my answer to solve this problem.
in Windows system.
1.in cmd terminal,usr cmd netstat -aon|findstr "5555"
2.use cmd tasklist|find "PID",the PID para should be a process number which is the result of the first step .
3.changed the Port No. to other ,which should not be "5555"
That's done.
After trying:
adb kill-server
stopping adb.exe in task manager
adb usb
and a few other stuff I can't even remember. . .
I restarted my computer and the dummy-device was gone!

Android Emulator starts but Eclipse doesn't recognize it

As a general rule, everything works fine, but then sometimes either Eclipse or my Android emulator decides to be a jerk and refuses to work.
I open the AVD Manager in Eclipse. I choose which AVD I want and click Start. The emulator starts up and it goes through the loooong process of booting. It finally finishes booting and then for some reason, it immediately reboots and goes through the looong process of booting again. Once it boots the second time, Eclipse loses track of it. It is no longer lists in the Devices tab and I can't install my app or run it on that emulator. If I kill the emulator and try to start it over, then I get the exact same behavior. It's incredibly frustrating.
There are no messages happening in the console to explain the behavior. Any idea why this is happening?
That's a known issue when adb starts before the emulator. I don't know the real reason, but a quick workaround is to restart adb in the command prompt (with the emulator running)
> adb kill-server
> adb start-server
Now,
> adb devices
will return the emulator and Eclipse will be able to install the app.
While in Eclipse, choose Window->Show View->Devices.
If you can't see the emulator on the newly opened window choose the down-arrow icon in the same window (near the minimize and maximize buttons) and from the dropdown menu select "Reset ADB".
The alternative is to open CMD.exe and type the following two commands (change the ADB directory as necessary):
C:\Program Files\Android\android-sdk\platform-tools\adb.exe kill-server
C:\Program Files\Android\android-sdk\platform-tools\adb.exe start-server
I've seen this too. If you kill and restart the adb server, Eclipse should then see it.
> ./adb kill-server
> ./adb start-server
tried these commands in mac os x / eclipse - works, but it also kills the actual devices and you have to unplug/plug them back in to get them back.

Categories

Resources